Skip to content

Commit 0dcabd1

Browse files
committed
c-ext: declare GIL as not used
Without this, the GIL is enabled when loading the extension module since we don't declare nogil compatibility. Let's allow loading without the GIL so we can start testing this config.
1 parent 7bb1183 commit 0dcabd1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

c-ext/backend_c.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ void decompressoriterator_module_init(PyObject *mod);
134134
void frameparams_module_init(PyObject *mod);
135135

136136
void zstd_module_init(PyObject *m) {
137+
#ifdef Py_GIL_DISABLED
138+
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
139+
#endif
140+
137141
/* python-zstandard relies on unstable zstd C API features. This means
138142
that changes in zstd may break expectations in python-zstandard.
139143

0 commit comments

Comments
 (0)