]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-103092: Support subinterpreters in ``_zstd`` (GH-133674) (#133695)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 8 May 2025 18:38:40 +0000 (20:38 +0200)
committerGitHub <noreply@github.com>
Thu, 8 May 2025 18:38:40 +0000 (18:38 +0000)
gh-103092: Support subinterpreters in ``_zstd`` (GH-133674)
(cherry picked from commit 6f6f48d28963f54c4b2b42d526e2e3045eb1fc1e)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Modules/_zstd/_zstdmodule.c
Modules/_zstd/_zstdmodule.h
Modules/_zstd/decompressor.c

index 4d046859a1540efde31758c6b0961179887ea5b4..4b14315462b1c56c5a121f237e4db8677668e972 100644 (file)
@@ -826,7 +826,7 @@ static int _zstd_exec(PyObject *module) {
     // ZstdDecompressor
     if (add_type_to_module(module,
                            "ZstdDecompressor",
-                           &ZstdDecompressor_type_spec,
+                           &zstddecompressor_type_spec,
                            &mod_state->ZstdDecompressor_type) < 0) {
         return -1;
     }
@@ -890,9 +890,9 @@ _zstd_free(void *module)
 
 static struct PyModuleDef_Slot _zstd_slots[] = {
     {Py_mod_exec, _zstd_exec},
+    {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
     {Py_mod_gil, Py_MOD_GIL_NOT_USED},
-
-    {0}
+    {0, NULL},
 };
 
 struct PyModuleDef _zstdmodule = {
index 1e9e4c75056831debde177c1dd7d9afab31a53b9..120fe9f84c754d969cf93adfc282b83daee27742 100644 (file)
@@ -32,7 +32,7 @@ get_zstd_state_from_type(PyTypeObject *type) {
 
 extern PyType_Spec zstddict_type_spec;
 extern PyType_Spec zstdcompressor_type_spec;
-extern PyType_Spec ZstdDecompressor_type_spec;
+extern PyType_Spec zstddecompressor_type_spec;
 
 struct _zstd_state {
     PyObject *empty_bytes;
index 748947af79c3f70ecb8034a1584842fcc263cb6e..dec917481ab1b521b1bbd0b60086f3e8efe74cef 100644 (file)
@@ -883,7 +883,7 @@ static PyType_Slot ZstdDecompressor_slots[] = {
     {0}
 };
 
-PyType_Spec ZstdDecompressor_type_spec = {
+PyType_Spec zstddecompressor_type_spec = {
     .name = "_zstd.ZstdDecompressor",
     .basicsize = sizeof(ZstdDecompressor),
     .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,