Skip to content

Commit 9baeb2b

Browse files
authored
MAINT: add free threading support to complex.extension (#655)
Add support for the experimental free-threading Python version in the complex.extension module. closes #654
1 parent 063fe8b commit 9baeb2b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/packages/complex/extension.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,12 @@ static struct PyModuleDef module = {
2222
};
2323

2424
PyMODINIT_FUNC PyInit_extension(void) {
25-
return PyModule_Create(&module);
25+
PyObject *m = PyModule_Create(&module);
26+
if (m == NULL) {
27+
return NULL;
28+
}
29+
#ifdef Py_GIL_DISABLED
30+
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
31+
#endif
32+
return m;
2633
}

0 commit comments

Comments
 (0)