Skip to content

Commit 018aed8

Browse files
authored
Merge pull request #70 from pycompression/3.14threaded
Declare GIL not used
2 parents 798fa1a + 5c48059 commit 018aed8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/zlib_ng/zlib_ngmodule.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2968,11 +2968,14 @@ static struct PyModuleDef zlibmodule = {
29682968
PyMODINIT_FUNC
29692969
PyInit_zlib_ng(void)
29702970
{
2971-
PyObject *m, *ver;
2972-
m = PyModule_Create(&zlibmodule);
2971+
PyObject *m = PyModule_Create(&zlibmodule);
29732972
if (m == NULL) {
29742973
return NULL;
29752974
}
2975+
#ifdef Py_GIL_DISABLED
2976+
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
2977+
#endif
2978+
29762979
if (PyType_Ready(&Comptype) < 0) {
29772980
return NULL;
29782981
}
@@ -3050,7 +3053,7 @@ PyInit_zlib_ng(void)
30503053
PyModule_AddIntMacro(m, Z_FINISH);
30513054
PyModule_AddIntMacro(m, Z_BLOCK);
30523055
PyModule_AddIntMacro(m, Z_TREES);
3053-
ver = PyUnicode_FromString(ZLIBNG_VERSION);
3056+
PyObject *ver = PyUnicode_FromString(ZLIBNG_VERSION);
30543057
if (ver != NULL)
30553058
PyModule_AddObject(m, "ZLIBNG_VERSION", ver);
30563059

0 commit comments

Comments
 (0)