diff --git a/src/markupsafe/_speedups.c b/src/markupsafe/_speedups.c index 2744dc3c..4624ee48 100644 --- a/src/markupsafe/_speedups.c +++ b/src/markupsafe/_speedups.c @@ -190,5 +190,12 @@ static struct PyModuleDef module_definition = { PyMODINIT_FUNC PyInit__speedups(void) { - return PyModule_Create(&module_definition); + PyObject *m = PyModule_Create(&module_definition); + if (m == NULL) { + return NULL; + } +#ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED); +#endif + return m; }