https://github.com/python/cpython/commit/6f6f48d28963f54c4b2b42d526e2e3045eb1fc1e
commit: 6f6f48d28963f54c4b2b42d526e2e3045eb1fc1e
branch: main
author: Adam Turner <9087854+aa-tur...@users.noreply.github.com>
committer: AA-Turner <9087854+aa-tur...@users.noreply.github.com>
date: 2025-05-08T19:11:34+01:00
summary:

gh-103092: Support subinterpreters in ``_zstd`` (#133674)

files:
M Modules/_zstd/_zstdmodule.c
M Modules/_zstd/_zstdmodule.h
M Modules/_zstd/decompressor.c

diff --git a/Modules/_zstd/_zstdmodule.c b/Modules/_zstd/_zstdmodule.c
index 4d046859a1540e..4b14315462b1c5 100644
--- a/Modules/_zstd/_zstdmodule.c
+++ b/Modules/_zstd/_zstdmodule.c
@@ -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 = {
diff --git a/Modules/_zstd/_zstdmodule.h b/Modules/_zstd/_zstdmodule.h
index 1e9e4c75056831..120fe9f84c754d 100644
--- a/Modules/_zstd/_zstdmodule.h
+++ b/Modules/_zstd/_zstdmodule.h
@@ -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;
diff --git a/Modules/_zstd/decompressor.c b/Modules/_zstd/decompressor.c
index 748947af79c3f7..dec917481ab1b5 100644
--- a/Modules/_zstd/decompressor.c
+++ b/Modules/_zstd/decompressor.c
@@ -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,

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to