summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrett Simmers <swtaarrs@users.noreply.github.com>2024-05-03 15:30:55 (GMT)
committerGitHub <noreply@github.com>2024-05-03 15:30:55 (GMT)
commitc2627d6eea924daf80f374c18a5fd73ef61283fa (patch)
tree91d94d70f490562b2773aadb49b8befee6354f75 /Modules
parent3e818afb9b7c557aa633aeb3d5c4959750feeab0 (diff)
downloadcpython-c2627d6eea924daf80f374c18a5fd73ef61283fa.zip
cpython-c2627d6eea924daf80f374c18a5fd73ef61283fa.tar.gz
cpython-c2627d6eea924daf80f374c18a5fd73ef61283fa.tar.bz2
gh-116322: Add Py_mod_gil module slot (#116882)
This PR adds the ability to enable the GIL if it was disabled at interpreter startup, and modifies the multi-phase module initialization path to enable the GIL when loading a module, unless that module's spec includes a slot indicating it can run safely without the GIL. PEP 703 called the constant for the slot `Py_mod_gil_not_used`; I went with `Py_MOD_GIL_NOT_USED` for consistency with gh-104148. A warning will be issued up to once per interpreter for the first GIL-using module that is loaded. If `-v` is given, a shorter message will be printed to stderr every time a GIL-using module is loaded (including the first one that issues a warning).
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_abc.c1
-rw-r--r--Modules/_asynciomodule.c1
-rw-r--r--Modules/_bisectmodule.c1
-rw-r--r--Modules/_blake2/blake2module.c1
-rw-r--r--Modules/_bz2module.c1
-rw-r--r--Modules/_codecsmodule.c1
-rw-r--r--Modules/_collectionsmodule.c1
-rw-r--r--Modules/_contextvarsmodule.c1
-rw-r--r--Modules/_csv.c1
-rw-r--r--Modules/_ctypes/_ctypes.c1
-rw-r--r--Modules/_ctypes/_ctypes_test.c5
-rw-r--r--Modules/_curses_panel.c1
-rw-r--r--Modules/_cursesmodule.c3
-rw-r--r--Modules/_datetimemodule.c3
-rw-r--r--Modules/_dbmmodule.c1
-rw-r--r--Modules/_decimal/_decimal.c1
-rw-r--r--Modules/_elementtree.c1
-rw-r--r--Modules/_functoolsmodule.c1
-rw-r--r--Modules/_gdbmmodule.c1
-rw-r--r--Modules/_hashopenssl.c1
-rw-r--r--Modules/_heapqmodule.c1
-rw-r--r--Modules/_interpchannelsmodule.c1
-rw-r--r--Modules/_interpqueuesmodule.c1
-rw-r--r--Modules/_interpretersmodule.c1
-rw-r--r--Modules/_io/_iomodule.c1
-rw-r--r--Modules/_json.c1
-rw-r--r--Modules/_localemodule.c1
-rw-r--r--Modules/_lsprof.c1
-rw-r--r--Modules/_lzmamodule.c1
-rw-r--r--Modules/_multiprocessing/multiprocessing.c1
-rw-r--r--Modules/_multiprocessing/posixshmem.c5
-rw-r--r--Modules/_opcode.c1
-rw-r--r--Modules/_operator.c1
-rw-r--r--Modules/_pickle.c1
-rw-r--r--Modules/_posixsubprocess.c1
-rw-r--r--Modules/_queuemodule.c1
-rw-r--r--Modules/_randommodule.c1
-rw-r--r--Modules/_scproxy.c5
-rw-r--r--Modules/_sqlite/module.c1
-rw-r--r--Modules/_sre/sre.c1
-rw-r--r--Modules/_ssl.c1
-rw-r--r--Modules/_stat.c1
-rw-r--r--Modules/_statisticsmodule.c5
-rw-r--r--Modules/_struct.c1
-rw-r--r--Modules/_suggestions.c14
-rw-r--r--Modules/_sysconfig.c1
-rw-r--r--Modules/_testbuffer.c3
-rw-r--r--Modules/_testcapimodule.c3
-rw-r--r--Modules/_testclinic.c3
-rw-r--r--Modules/_testclinic_limited.c3
-rw-r--r--Modules/_testexternalinspection.c6
-rw-r--r--Modules/_testimportmultiple.c26
-rw-r--r--Modules/_testinternalcapi.c1
-rw-r--r--Modules/_testlimitedcapi.c3
-rw-r--r--Modules/_testmultiphase.c21
-rw-r--r--Modules/_testsinglephase.c9
-rw-r--r--Modules/_threadmodule.c1
-rw-r--r--Modules/_tkinter.c3
-rw-r--r--Modules/_tracemalloc.c3
-rw-r--r--Modules/_typingmodule.c1
-rw-r--r--Modules/_uuidmodule.c5
-rw-r--r--Modules/_weakref.c1
-rw-r--r--Modules/_winapi.c1
-rw-r--r--Modules/_xxtestfuzz/_xxtestfuzz.c9
-rw-r--r--Modules/_zoneinfo.c1
-rw-r--r--Modules/arraymodule.c1
-rw-r--r--Modules/atexitmodule.c1
-rw-r--r--Modules/binascii.c1
-rw-r--r--Modules/cjkcodecs/cjkcodecs.h1
-rw-r--r--Modules/cjkcodecs/multibytecodec.c1
-rw-r--r--Modules/cmathmodule.c1
-rw-r--r--Modules/errnomodule.c5
-rw-r--r--Modules/faulthandler.c1
-rw-r--r--Modules/fcntlmodule.c1
-rw-r--r--Modules/gcmodule.c1
-rw-r--r--Modules/grpmodule.c1
-rw-r--r--Modules/itertoolsmodule.c1
-rw-r--r--Modules/mathmodule.c1
-rw-r--r--Modules/md5module.c1
-rw-r--r--Modules/mmapmodule.c1
-rw-r--r--Modules/overlapped.c1
-rw-r--r--Modules/posixmodule.c1
-rw-r--r--Modules/pwdmodule.c1
-rw-r--r--Modules/pyexpat.c1
-rw-r--r--Modules/readline.c3
-rw-r--r--Modules/resource.c1
-rw-r--r--Modules/selectmodule.c1
-rw-r--r--Modules/sha1module.c1
-rw-r--r--Modules/sha2module.c1
-rw-r--r--Modules/sha3module.c1
-rw-r--r--Modules/signalmodule.c1
-rw-r--r--Modules/socketmodule.c1
-rw-r--r--Modules/symtablemodule.c1
-rw-r--r--Modules/syslogmodule.c1
-rw-r--r--Modules/termios.c1
-rw-r--r--Modules/timemodule.c1
-rw-r--r--Modules/unicodedata.c1
-rw-r--r--Modules/xxlimited.c5
-rw-r--r--Modules/xxlimited_35.c4
-rw-r--r--Modules/xxmodule.c1
-rw-r--r--Modules/xxsubtype.c1
-rw-r--r--Modules/zlibmodule.c1
102 files changed, 200 insertions, 32 deletions
diff --git a/Modules/_abc.c b/Modules/_abc.c
index f2a523e..4f4b24b 100644
--- a/Modules/_abc.c
+++ b/Modules/_abc.c
@@ -970,6 +970,7 @@ _abcmodule_free(void *module)
static PyModuleDef_Slot _abcmodule_slots[] = {
{Py_mod_exec, _abcmodule_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index 0873d32..a26714f 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -3795,6 +3795,7 @@ module_exec(PyObject *mod)
static struct PyModuleDef_Slot module_slots[] = {
{Py_mod_exec, module_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
diff --git a/Modules/_bisectmodule.c b/Modules/_bisectmodule.c
index 9e0fd33..56322c4 100644
--- a/Modules/_bisectmodule.c
+++ b/Modules/_bisectmodule.c
@@ -462,6 +462,7 @@ bisect_modexec(PyObject *m)
static PyModuleDef_Slot bisect_slots[] = {
{Py_mod_exec, bisect_modexec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_blake2/blake2module.c b/Modules/_blake2/blake2module.c
index 5df9fd3..7824221 100644
--- a/Modules/_blake2/blake2module.c
+++ b/Modules/_blake2/blake2module.c
@@ -137,6 +137,7 @@ blake2_exec(PyObject *m)
static PyModuleDef_Slot _blake2_slots[] = {
{Py_mod_exec, blake2_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_bz2module.c b/Modules/_bz2module.c
index 3d0d4ee..661847a 100644
--- a/Modules/_bz2module.c
+++ b/Modules/_bz2module.c
@@ -802,6 +802,7 @@ _bz2_free(void *module)
static struct PyModuleDef_Slot _bz2_slots[] = {
{Py_mod_exec, _bz2_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_codecsmodule.c b/Modules/_codecsmodule.c
index c31c1b6..32373f0 100644
--- a/Modules/_codecsmodule.c
+++ b/Modules/_codecsmodule.c
@@ -1050,6 +1050,7 @@ static PyMethodDef _codecs_functions[] = {
static PyModuleDef_Slot _codecs_slots[] = {
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index 309d63c..b865351 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -2817,6 +2817,7 @@ collections_exec(PyObject *module) {
static struct PyModuleDef_Slot collections_slots[] = {
{Py_mod_exec, collections_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_contextvarsmodule.c b/Modules/_contextvarsmodule.c
index f621c1d..3f96f07 100644
--- a/Modules/_contextvarsmodule.c
+++ b/Modules/_contextvarsmodule.c
@@ -45,6 +45,7 @@ _contextvars_exec(PyObject *m)
static struct PyModuleDef_Slot _contextvars_slots[] = {
{Py_mod_exec, _contextvars_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_csv.c b/Modules/_csv.c
index ac948f4..9d6b66d 100644
--- a/Modules/_csv.c
+++ b/Modules/_csv.c
@@ -1796,6 +1796,7 @@ csv_exec(PyObject *module) {
static PyModuleDef_Slot csv_slots[] = {
{Py_mod_exec, csv_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 3cb0b24..1b1a0ea 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -5948,6 +5948,7 @@ module_free(void *module)
static PyModuleDef_Slot module_slots[] = {
{Py_mod_exec, _ctypes_mod_exec},
{Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_ctypes/_ctypes_test.c b/Modules/_ctypes/_ctypes_test.c
index 1dd3ef1..f46f636 100644
--- a/Modules/_ctypes/_ctypes_test.c
+++ b/Modules/_ctypes/_ctypes_test.c
@@ -1,7 +1,7 @@
-// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
+// Need limited C API version 3.13 for Py_mod_gil
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
-# define Py_LIMITED_API 0x030c0000
+# define Py_LIMITED_API 0x030d0000
#endif
// gh-85283: On Windows, Py_LIMITED_API requires Py_BUILD_CORE to not attempt
@@ -1167,6 +1167,7 @@ _testfunc_pylist_append(PyObject *list, PyObject *item)
static struct PyModuleDef_Slot _ctypes_test_slots[] = {
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c
index 2ec8f34..125c72d 100644
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -697,6 +697,7 @@ static PyModuleDef_Slot _curses_slots[] = {
// XXX gh-103092: fix isolation.
{Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
//{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index d04d1e9..8bf6824 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -4743,6 +4743,9 @@ PyInit__curses(void)
m = PyModule_Create(&_cursesmodule);
if (m == NULL)
return NULL;
+#ifdef Py_GIL_DISABLED
+ PyModule_ExperimentalSetGIL(m, Py_MOD_GIL_NOT_USED);
+#endif
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index 06004e2..00015c5 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -6984,6 +6984,9 @@ PyInit__datetime(void)
PyObject *mod = PyModule_Create(&datetimemodule);
if (mod == NULL)
return NULL;
+#ifdef Py_GIL_DISABLED
+ PyModule_ExperimentalSetGIL(mod, Py_MOD_GIL_NOT_USED);
+#endif
if (_datetime_exec(mod) < 0) {
Py_DECREF(mod);
diff --git a/Modules/_dbmmodule.c b/Modules/_dbmmodule.c
index ee33fe6..1be4234 100644
--- a/Modules/_dbmmodule.c
+++ b/Modules/_dbmmodule.c
@@ -616,6 +616,7 @@ _dbm_module_free(void *module)
static PyModuleDef_Slot _dbmmodule_slots[] = {
{Py_mod_exec, _dbm_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c
index fe67111..2daa24c 100644
--- a/Modules/_decimal/_decimal.c
+++ b/Modules/_decimal/_decimal.c
@@ -6157,6 +6157,7 @@ decimal_free(void *module)
static struct PyModuleDef_Slot _decimal_slots[] = {
{Py_mod_exec, _decimal_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index aaa0cad..b11983d 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -4463,6 +4463,7 @@ error:
static struct PyModuleDef_Slot elementtree_slots[] = {
{Py_mod_exec, module_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index e37473a..9dee7bf 100644
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -1559,6 +1559,7 @@ _functools_free(void *module)
static struct PyModuleDef_Slot _functools_slots[] = {
{Py_mod_exec, _functools_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_gdbmmodule.c b/Modules/_gdbmmodule.c
index db868c1..df7fba6 100644
--- a/Modules/_gdbmmodule.c
+++ b/Modules/_gdbmmodule.c
@@ -825,6 +825,7 @@ _gdbm_module_free(void *module)
static PyModuleDef_Slot _gdbm_module_slots[] = {
{Py_mod_exec, _gdbm_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c
index d0b4681..14d9c18 100644
--- a/Modules/_hashopenssl.c
+++ b/Modules/_hashopenssl.c
@@ -2289,6 +2289,7 @@ static PyModuleDef_Slot hashlib_slots[] = {
{Py_mod_exec, hashlib_init_constructors},
{Py_mod_exec, hashlib_exception},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_heapqmodule.c b/Modules/_heapqmodule.c
index 9d4ec25..695ce22 100644
--- a/Modules/_heapqmodule.c
+++ b/Modules/_heapqmodule.c
@@ -681,6 +681,7 @@ heapq_exec(PyObject *m)
static struct PyModuleDef_Slot heapq_slots[] = {
{Py_mod_exec, heapq_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_interpchannelsmodule.c b/Modules/_interpchannelsmodule.c
index 43c9658..ff8dacf 100644
--- a/Modules/_interpchannelsmodule.c
+++ b/Modules/_interpchannelsmodule.c
@@ -3326,6 +3326,7 @@ error:
static struct PyModuleDef_Slot module_slots[] = {
{Py_mod_exec, module_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
diff --git a/Modules/_interpqueuesmodule.c b/Modules/_interpqueuesmodule.c
index 46801bd..556953d 100644
--- a/Modules/_interpqueuesmodule.c
+++ b/Modules/_interpqueuesmodule.c
@@ -1830,6 +1830,7 @@ error:
static struct PyModuleDef_Slot module_slots[] = {
{Py_mod_exec, module_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
diff --git a/Modules/_interpretersmodule.c b/Modules/_interpretersmodule.c
index 8fea569..86a4113 100644
--- a/Modules/_interpretersmodule.c
+++ b/Modules/_interpretersmodule.c
@@ -1519,6 +1519,7 @@ error:
static struct PyModuleDef_Slot module_slots[] = {
{Py_mod_exec, module_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c
index 173f5b5..269070f 100644
--- a/Modules/_io/_iomodule.c
+++ b/Modules/_io/_iomodule.c
@@ -720,6 +720,7 @@ iomodule_exec(PyObject *m)
static struct PyModuleDef_Slot iomodule_slots[] = {
{Py_mod_exec, iomodule_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
diff --git a/Modules/_json.c b/Modules/_json.c
index c552998..fc39f62 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -1780,6 +1780,7 @@ _json_exec(PyObject *module)
static PyModuleDef_Slot _json_slots[] = {
{Py_mod_exec, _json_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index fe8e4c5..d492344 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -860,6 +860,7 @@ _locale_exec(PyObject *module)
static struct PyModuleDef_Slot _locale_slots[] = {
{Py_mod_exec, _locale_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_lsprof.c b/Modules/_lsprof.c
index a76c3de..18be01d 100644
--- a/Modules/_lsprof.c
+++ b/Modules/_lsprof.c
@@ -1006,6 +1006,7 @@ _lsprof_exec(PyObject *module)
static PyModuleDef_Slot _lsprofslots[] = {
{Py_mod_exec, _lsprof_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_lzmamodule.c b/Modules/_lzmamodule.c
index f6bfbfa..97f3a8f 100644
--- a/Modules/_lzmamodule.c
+++ b/Modules/_lzmamodule.c
@@ -1604,6 +1604,7 @@ static PyMethodDef lzma_methods[] = {
static PyModuleDef_Slot lzma_slots[] = {
{Py_mod_exec, lzma_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_multiprocessing/multiprocessing.c b/Modules/_multiprocessing/multiprocessing.c
index 1f6ab71..cee8cf7 100644
--- a/Modules/_multiprocessing/multiprocessing.c
+++ b/Modules/_multiprocessing/multiprocessing.c
@@ -277,6 +277,7 @@ multiprocessing_exec(PyObject *module)
static PyModuleDef_Slot multiprocessing_slots[] = {
{Py_mod_exec, multiprocessing_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_multiprocessing/posixshmem.c b/Modules/_multiprocessing/posixshmem.c
index d332a4e..aeb2d79 100644
--- a/Modules/_multiprocessing/posixshmem.c
+++ b/Modules/_multiprocessing/posixshmem.c
@@ -2,10 +2,10 @@
posixshmem - A Python extension that provides shm_open() and shm_unlink()
*/
-// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
+// Need limited C API version 3.13 for Py_mod_gil
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
-# define Py_LIMITED_API 0x030c0000
+# define Py_LIMITED_API 0x030d0000
#endif
#include <Python.h>
@@ -128,6 +128,7 @@ static PyMethodDef module_methods[ ] = {
static PyModuleDef_Slot module_slots[] = {
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_opcode.c b/Modules/_opcode.c
index 85e0ffe..cc72cb1 100644
--- a/Modules/_opcode.c
+++ b/Modules/_opcode.c
@@ -406,6 +406,7 @@ _opcode_exec(PyObject *m) {
static PyModuleDef_Slot module_slots[] = {
{Py_mod_exec, _opcode_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_operator.c b/Modules/_operator.c
index 306d450..5d3f883 100644
--- a/Modules/_operator.c
+++ b/Modules/_operator.c
@@ -1928,6 +1928,7 @@ operator_exec(PyObject *module)
static struct PyModuleDef_Slot operator_slots[] = {
{Py_mod_exec, operator_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index d7ffb04..754a326 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -7863,6 +7863,7 @@ _pickle_exec(PyObject *m)
static PyModuleDef_Slot pickle_slots[] = {
{Py_mod_exec, _pickle_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c
index b160cd7..daec4ad 100644
--- a/Modules/_posixsubprocess.c
+++ b/Modules/_posixsubprocess.c
@@ -1317,6 +1317,7 @@ static PyMethodDef module_methods[] = {
static PyModuleDef_Slot _posixsubprocess_slots[] = {
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_queuemodule.c b/Modules/_queuemodule.c
index 5db9b64..aee8db8 100644
--- a/Modules/_queuemodule.c
+++ b/Modules/_queuemodule.c
@@ -594,6 +594,7 @@ queuemodule_exec(PyObject *module)
static PyModuleDef_Slot queuemodule_slots[] = {
{Py_mod_exec, queuemodule_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c
index 56b891d..140640a 100644
--- a/Modules/_randommodule.c
+++ b/Modules/_randommodule.c
@@ -642,6 +642,7 @@ _random_exec(PyObject *module)
static PyModuleDef_Slot _random_slots[] = {
{Py_mod_exec, _random_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_scproxy.c b/Modules/_scproxy.c
index 042738b..e9170f2 100644
--- a/Modules/_scproxy.c
+++ b/Modules/_scproxy.c
@@ -3,10 +3,10 @@
* using the SystemConfiguration framework.
*/
-// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
+// Need limited C API version 3.13 for Py_mod_gil
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
-# define Py_LIMITED_API 0x030c0000
+# define Py_LIMITED_API 0x030d0000
#endif
#include <Python.h>
@@ -239,6 +239,7 @@ static PyMethodDef mod_methods[] = {
static PyModuleDef_Slot _scproxy_slots[] = {
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c
index 46fed9f..2c25ee3 100644
--- a/Modules/_sqlite/module.c
+++ b/Modules/_sqlite/module.c
@@ -758,6 +758,7 @@ error:
static struct PyModuleDef_Slot module_slots[] = {
{Py_mod_exec, module_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
diff --git a/Modules/_sre/sre.c b/Modules/_sre/sre.c
index 00fbd96..c1eff63 100644
--- a/Modules/_sre/sre.c
+++ b/Modules/_sre/sre.c
@@ -3272,6 +3272,7 @@ error:
static PyModuleDef_Slot sre_slots[] = {
{Py_mod_exec, sre_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 885a9c2..9d50b57 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -6515,6 +6515,7 @@ static PyModuleDef_Slot sslmodule_slots[] = {
{Py_mod_exec, sslmodule_init_strings},
{Py_mod_exec, sslmodule_init_lock},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_stat.c b/Modules/_stat.c
index 8059ec2..a4f15e8 100644
--- a/Modules/_stat.c
+++ b/Modules/_stat.c
@@ -679,6 +679,7 @@ stat_exec(PyObject *module)
static PyModuleDef_Slot stat_slots[] = {
{Py_mod_exec, stat_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_statisticsmodule.c b/Modules/_statisticsmodule.c
index 78a6552..b84f731 100644
--- a/Modules/_statisticsmodule.c
+++ b/Modules/_statisticsmodule.c
@@ -1,9 +1,9 @@
/* statistics accelerator C extension: _statistics module. */
-// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
+// Need limited C API version 3.13 for Py_mod_gil
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
-# define Py_LIMITED_API 0x030c0000
+# define Py_LIMITED_API 0x030d0000
#endif
#include "Python.h"
@@ -136,6 +136,7 @@ PyDoc_STRVAR(statistics_doc,
static struct PyModuleDef_Slot _statisticsmodule_slots[] = {
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_struct.c b/Modules/_struct.c
index fa2cd37..905dcbd 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -2593,6 +2593,7 @@ _structmodule_exec(PyObject *m)
static PyModuleDef_Slot _structmodule_slots[] = {
{Py_mod_exec, _structmodule_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_suggestions.c b/Modules/_suggestions.c
index 30b524d..80c7179 100644
--- a/Modules/_suggestions.c
+++ b/Modules/_suggestions.c
@@ -49,15 +49,21 @@ static PyMethodDef module_methods[] = {
{NULL, NULL, 0, NULL} // Sentinel
};
+static PyModuleDef_Slot module_slots[] = {
+ {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
+ {0, NULL},
+};
+
static struct PyModuleDef suggestions_module = {
PyModuleDef_HEAD_INIT,
"_suggestions",
NULL,
- -1,
- module_methods
+ 0,
+ module_methods,
+ module_slots,
};
PyMODINIT_FUNC PyInit__suggestions(void) {
- return PyModule_Create(&suggestions_module);
+ return PyModuleDef_Init(&suggestions_module);
}
-
diff --git a/Modules/_sysconfig.c b/Modules/_sysconfig.c
index c76b9e6..c50c5cf 100644
--- a/Modules/_sysconfig.c
+++ b/Modules/_sysconfig.c
@@ -80,6 +80,7 @@ static struct PyMethodDef sysconfig_methods[] = {
static PyModuleDef_Slot sysconfig_slots[] = {
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c
index 9e77744..35d4ffe 100644
--- a/Modules/_testbuffer.c
+++ b/Modules/_testbuffer.c
@@ -2901,6 +2901,9 @@ PyInit__testbuffer(void)
if (mod == NULL) {
return NULL;
}
+#ifdef Py_GIL_DISABLED
+ PyModule_ExperimentalSetGIL(mod, Py_MOD_GIL_NOT_USED);
+#endif
if (_testbuffer_exec(mod) < 0) {
Py_DECREF(mod);
return NULL;
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index f5892fc..beae13c 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -3935,6 +3935,9 @@ PyInit__testcapi(void)
m = PyModule_Create(&_testcapimodule);
if (m == NULL)
return NULL;
+#ifdef Py_GIL_DISABLED
+ PyModule_ExperimentalSetGIL(m, Py_MOD_GIL_NOT_USED);
+#endif
Py_SET_TYPE(&_HashInheritanceTester_Type, &PyType_Type);
if (PyType_Ready(&_HashInheritanceTester_Type) < 0) {
diff --git a/Modules/_testclinic.c b/Modules/_testclinic.c
index 2e9d00a..c7af552 100644
--- a/Modules/_testclinic.c
+++ b/Modules/_testclinic.c
@@ -1955,6 +1955,9 @@ PyInit__testclinic(void)
if (m == NULL) {
return NULL;
}
+#ifdef Py_GIL_DISABLED
+ PyModule_ExperimentalSetGIL(m, Py_MOD_GIL_NOT_USED);
+#endif
if (PyModule_AddType(m, &TestClass) < 0) {
goto error;
}
diff --git a/Modules/_testclinic_limited.c b/Modules/_testclinic_limited.c
index 29f1b7c..d5f9808 100644
--- a/Modules/_testclinic_limited.c
+++ b/Modules/_testclinic_limited.c
@@ -146,5 +146,8 @@ PyInit__testclinic_limited(void)
if (m == NULL) {
return NULL;
}
+#ifdef Py_GIL_DISABLED
+ PyModule_ExperimentalSetGIL(m, Py_MOD_GIL_NOT_USED);
+#endif
return m;
}
diff --git a/Modules/_testexternalinspection.c b/Modules/_testexternalinspection.c
index e2f96cd..d9c65fe 100644
--- a/Modules/_testexternalinspection.c
+++ b/Modules/_testexternalinspection.c
@@ -627,6 +627,12 @@ PyMODINIT_FUNC
PyInit__testexternalinspection(void)
{
PyObject* mod = PyModule_Create(&module);
+ if (mod == NULL) {
+ return NULL;
+ }
+#ifdef Py_GIL_DISABLED
+ PyModule_ExperimentalSetGIL(mod, Py_MOD_GIL_NOT_USED);
+#endif
int rc = PyModule_AddIntConstant(mod, "PROCESS_VM_READV_SUPPORTED", HAVE_PROCESS_VM_READV);
if (rc < 0) {
Py_DECREF(mod);
diff --git a/Modules/_testimportmultiple.c b/Modules/_testimportmultiple.c
index a65ca51..c147596 100644
--- a/Modules/_testimportmultiple.c
+++ b/Modules/_testimportmultiple.c
@@ -6,18 +6,24 @@
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
-# define Py_LIMITED_API 0x03020000
+# define Py_LIMITED_API 0x030d0000
#endif
#include <Python.h>
+static PyModuleDef_Slot shared_slots[] = {
+ {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
+ {0, NULL},
+};
+
static struct PyModuleDef _testimportmultiple = {
PyModuleDef_HEAD_INIT,
"_testimportmultiple",
"_testimportmultiple doc",
- -1,
- NULL,
+ 0,
NULL,
+ shared_slots,
NULL,
NULL,
NULL
@@ -25,16 +31,16 @@ static struct PyModuleDef _testimportmultiple = {
PyMODINIT_FUNC PyInit__testimportmultiple(void)
{
- return PyModule_Create(&_testimportmultiple);
+ return PyModuleDef_Init(&_testimportmultiple);
}
static struct PyModuleDef _foomodule = {
PyModuleDef_HEAD_INIT,
"_testimportmultiple_foo",
"_testimportmultiple_foo doc",
- -1,
- NULL,
+ 0,
NULL,
+ shared_slots,
NULL,
NULL,
NULL
@@ -42,21 +48,21 @@ static struct PyModuleDef _foomodule = {
PyMODINIT_FUNC PyInit__testimportmultiple_foo(void)
{
- return PyModule_Create(&_foomodule);
+ return PyModuleDef_Init(&_foomodule);
}
static struct PyModuleDef _barmodule = {
PyModuleDef_HEAD_INIT,
"_testimportmultiple_bar",
"_testimportmultiple_bar doc",
- -1,
- NULL,
+ 0,
NULL,
+ shared_slots,
NULL,
NULL,
NULL
};
PyMODINIT_FUNC PyInit__testimportmultiple_bar(void){
- return PyModule_Create(&_barmodule);
+ return PyModuleDef_Init(&_barmodule);
}
diff --git a/Modules/_testinternalcapi.c b/Modules/_testinternalcapi.c
index f7952a1..de98af3 100644
--- a/Modules/_testinternalcapi.c
+++ b/Modules/_testinternalcapi.c
@@ -2142,6 +2142,7 @@ module_exec(PyObject *module)
static struct PyModuleDef_Slot module_slots[] = {
{Py_mod_exec, module_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
diff --git a/Modules/_testlimitedcapi.c b/Modules/_testlimitedcapi.c
index 598071f..f88476f 100644
--- a/Modules/_testlimitedcapi.c
+++ b/Modules/_testlimitedcapi.c
@@ -25,6 +25,9 @@ PyInit__testlimitedcapi(void)
if (mod == NULL) {
return NULL;
}
+#ifdef Py_GIL_DISABLED
+ PyModule_ExperimentalSetGIL(mod, Py_MOD_GIL_NOT_USED);
+#endif
if (_PyTestLimitedCAPI_Init_Abstract(mod) < 0) {
return NULL;
diff --git a/Modules/_testmultiphase.c b/Modules/_testmultiphase.c
index 21c5f69..ca3d832 100644
--- a/Modules/_testmultiphase.c
+++ b/Modules/_testmultiphase.c
@@ -431,6 +431,7 @@ static int execfunc(PyObject *m)
static PyModuleDef_Slot main_slots[] = {
{Py_mod_exec, execfunc},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
@@ -519,13 +520,18 @@ PyInit__testmultiphase_nonmodule_with_methods(void)
/**** Non-ASCII-named modules ****/
+static PyModuleDef_Slot nonascii_slots[] = {
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
+ {0, NULL},
+};
+
static PyModuleDef def_nonascii_latin = { \
PyModuleDef_HEAD_INIT, /* m_base */
"_testmultiphase_nonascii_latin", /* m_name */
PyDoc_STR("Module named in Czech"), /* m_doc */
0, /* m_size */
NULL, /* m_methods */
- NULL, /* m_slots */
+ nonascii_slots, /* m_slots */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
@@ -543,7 +549,7 @@ static PyModuleDef def_nonascii_kana = { \
PyDoc_STR("Module named in Japanese"), /* m_doc */
0, /* m_size */
NULL, /* m_methods */
- NULL, /* m_slots */
+ nonascii_slots, /* m_slots */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
@@ -757,6 +763,7 @@ static PyModuleDef_Slot slots_nonmodule_with_exec_slots[] = {
{Py_mod_create, createfunc_nonmodule},
{Py_mod_exec, execfunc},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
@@ -778,6 +785,7 @@ execfunc_err(PyObject *mod)
static PyModuleDef_Slot slots_exec_err[] = {
{Py_mod_exec, execfunc_err},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
@@ -800,6 +808,7 @@ execfunc_raise(PyObject *spec)
static PyModuleDef_Slot slots_exec_raise[] = {
{Py_mod_exec, execfunc_raise},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
@@ -822,6 +831,7 @@ execfunc_unreported_exception(PyObject *mod)
static PyModuleDef_Slot slots_exec_unreported_exception[] = {
{Py_mod_exec, execfunc_unreported_exception},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
@@ -857,6 +867,7 @@ meth_state_access_exec(PyObject *m)
static PyModuleDef_Slot meth_state_access_slots[] = {
{Py_mod_exec, meth_state_access_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
@@ -889,6 +900,9 @@ PyInit__test_module_state_shared(void)
if (module == NULL) {
return NULL;
}
+#ifdef Py_GIL_DISABLED
+ PyModule_ExperimentalSetGIL(module, Py_MOD_GIL_NOT_USED);
+#endif
if (PyModule_AddObjectRef(module, "Error", PyExc_Exception) < 0) {
Py_DECREF(module);
@@ -903,6 +917,7 @@ PyInit__test_module_state_shared(void)
static PyModuleDef_Slot slots_multiple_multiple_interpreters_slots[] = {
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
@@ -920,6 +935,7 @@ PyInit__testmultiphase_multiple_multiple_interpreters_slots(void)
static PyModuleDef_Slot non_isolated_slots[] = {
{Py_mod_exec, execfunc},
{Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
@@ -940,6 +956,7 @@ static PyModuleDef_Slot shared_gil_only_slots[] = {
We put it here explicitly to draw attention to the contrast
with Py_MOD_PER_INTERPRETER_GIL_SUPPORTED. */
{Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
diff --git a/Modules/_testsinglephase.c b/Modules/_testsinglephase.c
index ff533e4..c0eb266 100644
--- a/Modules/_testsinglephase.c
+++ b/Modules/_testsinglephase.c
@@ -471,6 +471,9 @@ init__testsinglephase_basic(PyModuleDef *def)
if (module == NULL) {
return NULL;
}
+#ifdef Py_GIL_DISABLED
+ PyModule_ExperimentalSetGIL(module, Py_MOD_GIL_NOT_USED);
+#endif
module_state *state = &global_state.module;
// It may have been set by a previous run or under a different name.
@@ -562,6 +565,9 @@ PyInit__testsinglephase_with_reinit(void)
if (module == NULL) {
return NULL;
}
+#ifdef Py_GIL_DISABLED
+ PyModule_ExperimentalSetGIL(module, Py_MOD_GIL_NOT_USED);
+#endif
assert(get_module_state(module) == NULL);
@@ -624,6 +630,9 @@ PyInit__testsinglephase_with_state(void)
if (module == NULL) {
return NULL;
}
+#ifdef Py_GIL_DISABLED
+ PyModule_ExperimentalSetGIL(module, Py_MOD_GIL_NOT_USED);
+#endif
module_state *state = get_module_state(module);
assert(state != NULL);
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index f5e3b42..39d3097 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -2544,6 +2544,7 @@ The 'threading' module provides a more convenient interface.");
static PyModuleDef_Slot thread_module_slots[] = {
{Py_mod_exec, thread_module_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index e378986..ecb7ca8 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -3205,6 +3205,9 @@ PyInit__tkinter(void)
m = PyModule_Create(&_tkintermodule);
if (m == NULL)
return NULL;
+#ifdef Py_GIL_DISABLED
+ PyModule_ExperimentalSetGIL(m, Py_MOD_GIL_NOT_USED);
+#endif
Tkinter_TclError = PyErr_NewException("_tkinter.TclError", NULL, NULL);
if (PyModule_AddObjectRef(m, "TclError", Tkinter_TclError)) {
diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c
index 6dba3cac..55028dc 100644
--- a/Modules/_tracemalloc.c
+++ b/Modules/_tracemalloc.c
@@ -219,6 +219,9 @@ PyInit__tracemalloc(void)
m = PyModule_Create(&module_def);
if (m == NULL)
return NULL;
+#ifdef Py_GIL_DISABLED
+ PyModule_ExperimentalSetGIL(m, Py_MOD_GIL_NOT_USED);
+#endif
if (_PyTraceMalloc_Init() < 0) {
Py_DECREF(m);
diff --git a/Modules/_typingmodule.c b/Modules/_typingmodule.c
index 180f3d7..09fbb3c 100644
--- a/Modules/_typingmodule.c
+++ b/Modules/_typingmodule.c
@@ -72,6 +72,7 @@ _typing_exec(PyObject *m)
static struct PyModuleDef_Slot _typingmodule_slots[] = {
{Py_mod_exec, _typing_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_uuidmodule.c b/Modules/_uuidmodule.c
index 052cb9f..c5e78b1 100644
--- a/Modules/_uuidmodule.c
+++ b/Modules/_uuidmodule.c
@@ -3,10 +3,10 @@
* DCE compatible Universally Unique Identifier library.
*/
-// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
+// Need limited C API version 3.13 for Py_mod_gil
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
-# define Py_LIMITED_API 0x030c0000
+# define Py_LIMITED_API 0x030d0000
#endif
#include "Python.h"
@@ -111,6 +111,7 @@ static PyMethodDef uuid_methods[] = {
static PyModuleDef_Slot uuid_slots[] = {
{Py_mod_exec, uuid_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_weakref.c b/Modules/_weakref.c
index 1ea3ed5..a5c15c0 100644
--- a/Modules/_weakref.c
+++ b/Modules/_weakref.c
@@ -171,6 +171,7 @@ weakref_exec(PyObject *module)
static struct PyModuleDef_Slot weakref_slots[] = {
{Py_mod_exec, weakref_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_winapi.c b/Modules/_winapi.c
index 23e3c0d..cd5dd50 100644
--- a/Modules/_winapi.c
+++ b/Modules/_winapi.c
@@ -3189,6 +3189,7 @@ static int winapi_exec(PyObject *m)
static PyModuleDef_Slot winapi_slots[] = {
{Py_mod_exec, winapi_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/_xxtestfuzz/_xxtestfuzz.c b/Modules/_xxtestfuzz/_xxtestfuzz.c
index a2dbabc..2952d70 100644
--- a/Modules/_xxtestfuzz/_xxtestfuzz.c
+++ b/Modules/_xxtestfuzz/_xxtestfuzz.c
@@ -28,13 +28,18 @@ static PyMethodDef module_methods[] = {
{NULL},
};
+static PyModuleDef_Slot module_slots[] = {
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
+ {0, NULL},
+};
+
static struct PyModuleDef _fuzzmodule = {
PyModuleDef_HEAD_INIT,
"_fuzz",
NULL,
0,
module_methods,
- NULL,
+ module_slots,
NULL,
NULL,
NULL
@@ -43,5 +48,5 @@ static struct PyModuleDef _fuzzmodule = {
PyMODINIT_FUNC
PyInit__xxtestfuzz(void)
{
- return PyModule_Create(&_fuzzmodule);
+ return PyModuleDef_Init(&_fuzzmodule);
}
diff --git a/Modules/_zoneinfo.c b/Modules/_zoneinfo.c
index fcd4af6..38c3f0c 100644
--- a/Modules/_zoneinfo.c
+++ b/Modules/_zoneinfo.c
@@ -2760,6 +2760,7 @@ error:
static PyModuleDef_Slot zoneinfomodule_slots[] = {
{Py_mod_exec, zoneinfomodule_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 317f497..a3b833d 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -3220,6 +3220,7 @@ array_modexec(PyObject *m)
static PyModuleDef_Slot arrayslots[] = {
{Py_mod_exec, array_modexec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/atexitmodule.c b/Modules/atexitmodule.c
index 8e908da..297a8d7 100644
--- a/Modules/atexitmodule.c
+++ b/Modules/atexitmodule.c
@@ -322,6 +322,7 @@ Two public functions, register and unregister, are defined.\n\
static PyModuleDef_Slot atexitmodule_slots[] = {
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/binascii.c b/Modules/binascii.c
index 8649324..250f03a 100644
--- a/Modules/binascii.c
+++ b/Modules/binascii.c
@@ -1278,6 +1278,7 @@ binascii_exec(PyObject *module)
static PyModuleDef_Slot binascii_slots[] = {
{Py_mod_exec, binascii_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/cjkcodecs/cjkcodecs.h b/Modules/cjkcodecs/cjkcodecs.h
index 766f829..2b446ba 100644
--- a/Modules/cjkcodecs/cjkcodecs.h
+++ b/Modules/cjkcodecs/cjkcodecs.h
@@ -503,6 +503,7 @@ static struct PyMethodDef _cjk_methods[] = {
static PyModuleDef_Slot _cjk_slots[] = {
{Py_mod_exec, _cjk_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c
index e5433d7..1c671ad 100644
--- a/Modules/cjkcodecs/multibytecodec.c
+++ b/Modules/cjkcodecs/multibytecodec.c
@@ -2094,6 +2094,7 @@ static struct PyMethodDef _multibytecodec_methods[] = {
static PyModuleDef_Slot _multibytecodec_slots[] = {
{Py_mod_exec, _multibytecodec_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/cmathmodule.c b/Modules/cmathmodule.c
index 57bc556..d901b35 100644
--- a/Modules/cmathmodule.c
+++ b/Modules/cmathmodule.c
@@ -1363,6 +1363,7 @@ cmath_exec(PyObject *mod)
static PyModuleDef_Slot cmath_slots[] = {
{Py_mod_exec, cmath_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/errnomodule.c b/Modules/errnomodule.c
index 97e5f01..3f96f2f 100644
--- a/Modules/errnomodule.c
+++ b/Modules/errnomodule.c
@@ -1,9 +1,9 @@
/* Errno module */
-// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
+// Need limited C API version 3.13 for Py_mod_gil
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
-# define Py_LIMITED_API 0x030c0000
+# define Py_LIMITED_API 0x030d0000
#endif
#include "Python.h"
@@ -951,6 +951,7 @@ errno_exec(PyObject *module)
static PyModuleDef_Slot errno_slots[] = {
{Py_mod_exec, errno_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index c70d43a..cfa3cbd 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -1292,6 +1292,7 @@ static PyModuleDef_Slot faulthandler_slots[] = {
{Py_mod_exec, PyExec_faulthandler},
// XXX gh-103092: fix isolation.
//{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c
index e24e5f9..b6eeec2 100644
--- a/Modules/fcntlmodule.c
+++ b/Modules/fcntlmodule.c
@@ -745,6 +745,7 @@ fcntl_exec(PyObject *module)
static PyModuleDef_Slot fcntl_slots[] = {
{Py_mod_exec, fcntl_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
index 8a1b483..57e4aae 100644
--- a/Modules/gcmodule.c
+++ b/Modules/gcmodule.c
@@ -535,6 +535,7 @@ gcmodule_exec(PyObject *module)
static PyModuleDef_Slot gcmodule_slots[] = {
{Py_mod_exec, gcmodule_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c
index a1fa6cf..f7d3e12 100644
--- a/Modules/grpmodule.c
+++ b/Modules/grpmodule.c
@@ -342,6 +342,7 @@ grpmodule_exec(PyObject *module)
static PyModuleDef_Slot grpmodule_slots[] = {
{Py_mod_exec, grpmodule_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index 21ce3ec..8641c2f 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -4781,6 +4781,7 @@ itertoolsmodule_exec(PyObject *mod)
static struct PyModuleDef_Slot itertoolsmodule_slots[] = {
{Py_mod_exec, itertoolsmodule_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index 8ba0431..a3cbfc3 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -4177,6 +4177,7 @@ static PyMethodDef math_methods[] = {
static PyModuleDef_Slot math_slots[] = {
{Py_mod_exec, math_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/md5module.c b/Modules/md5module.c
index 9cbf11f..ef9163e 100644
--- a/Modules/md5module.c
+++ b/Modules/md5module.c
@@ -375,6 +375,7 @@ md5_exec(PyObject *m)
static PyModuleDef_Slot _md5_slots[] = {
{Py_mod_exec, md5_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 0cce7c2..dfc16ff 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -1801,6 +1801,7 @@ mmap_exec(PyObject *module)
static PyModuleDef_Slot mmap_slots[] = {
{Py_mod_exec, mmap_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/overlapped.c b/Modules/overlapped.c
index b9881d9..77ee70a 100644
--- a/Modules/overlapped.c
+++ b/Modules/overlapped.c
@@ -2070,6 +2070,7 @@ overlapped_exec(PyObject *module)
static PyModuleDef_Slot overlapped_slots[] = {
{Py_mod_exec, overlapped_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index e1a14e7..9f4be98 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -18071,6 +18071,7 @@ posixmodule_exec(PyObject *m)
static PyModuleDef_Slot posixmodile_slots[] = {
{Py_mod_exec, posixmodule_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c
index f58735a..2240e20 100644
--- a/Modules/pwdmodule.c
+++ b/Modules/pwdmodule.c
@@ -344,6 +344,7 @@ pwdmodule_exec(PyObject *module)
static PyModuleDef_Slot pwdmodule_slots[] = {
{Py_mod_exec, pwdmodule_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index f04f96b..f67d480 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -2117,6 +2117,7 @@ pyexpat_free(void *module)
static PyModuleDef_Slot pyexpat_slots[] = {
{Py_mod_exec, pyexpat_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/readline.c b/Modules/readline.c
index c5c3453..f59f8a9 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -1552,6 +1552,9 @@ PyInit_readline(void)
if (m == NULL)
return NULL;
+#ifdef Py_GIL_DISABLED
+ PyModule_ExperimentalSetGIL(m, Py_MOD_GIL_NOT_USED);
+#endif
if (PyModule_AddIntConstant(m, "_READLINE_VERSION",
RL_READLINE_VERSION) < 0) {
diff --git a/Modules/resource.c b/Modules/resource.c
index 8ee07bd..3fe18e7 100644
--- a/Modules/resource.c
+++ b/Modules/resource.c
@@ -513,6 +513,7 @@ resource_exec(PyObject *module)
static struct PyModuleDef_Slot resource_slots[] = {
{Py_mod_exec, resource_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 6ea141a..3eaee22 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -2802,6 +2802,7 @@ _select_exec(PyObject *m)
static PyModuleDef_Slot _select_slots[] = {
{Py_mod_exec, _select_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/sha1module.c b/Modules/sha1module.c
index 345a6c2..34a427a 100644
--- a/Modules/sha1module.c
+++ b/Modules/sha1module.c
@@ -371,6 +371,7 @@ _sha1_exec(PyObject *module)
static PyModuleDef_Slot _sha1_slots[] = {
{Py_mod_exec, _sha1_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/sha2module.c b/Modules/sha2module.c
index 60be422..7d6a1e4 100644
--- a/Modules/sha2module.c
+++ b/Modules/sha2module.c
@@ -866,6 +866,7 @@ static int sha2_exec(PyObject *module)
static PyModuleDef_Slot _sha2_slots[] = {
{Py_mod_exec, sha2_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/sha3module.c b/Modules/sha3module.c
index c30e924..084332c 100644
--- a/Modules/sha3module.c
+++ b/Modules/sha3module.c
@@ -602,6 +602,7 @@ _sha3_exec(PyObject *m)
static PyModuleDef_Slot _sha3_slots[] = {
{Py_mod_exec, _sha3_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 08fedea..7de5ebe 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -1698,6 +1698,7 @@ _signal_module_free(void *module)
static PyModuleDef_Slot signal_slots[] = {
{Py_mod_exec, signal_module_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 7720d59..daec560 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -8896,6 +8896,7 @@ error:
static struct PyModuleDef_Slot socket_slots[] = {
{Py_mod_exec, socket_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
diff --git a/Modules/symtablemodule.c b/Modules/symtablemodule.c
index ddc9ac3..b4dbb54 100644
--- a/Modules/symtablemodule.c
+++ b/Modules/symtablemodule.c
@@ -110,6 +110,7 @@ symtable_init_constants(PyObject *m)
static PyModuleDef_Slot symtable_slots[] = {
{Py_mod_exec, symtable_init_constants},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c
index cb3f2b0..14e7ca5 100644
--- a/Modules/syslogmodule.c
+++ b/Modules/syslogmodule.c
@@ -439,6 +439,7 @@ syslog_exec(PyObject *module)
static PyModuleDef_Slot syslog_slots[] = {
{Py_mod_exec, syslog_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/termios.c b/Modules/termios.c
index a29474d..f2c5a4b 100644
--- a/Modules/termios.c
+++ b/Modules/termios.c
@@ -1364,6 +1364,7 @@ termios_exec(PyObject *mod)
static PyModuleDef_Slot termios_slots[] = {
{Py_mod_exec, termios_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 3211c75..0511339 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -2128,6 +2128,7 @@ time_module_free(void *module)
static struct PyModuleDef_Slot time_slots[] = {
{Py_mod_exec, time_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c
index 6ae35b9..333ffe6 100644
--- a/Modules/unicodedata.c
+++ b/Modules/unicodedata.c
@@ -1668,6 +1668,7 @@ unicodedata_exec(PyObject *module)
static PyModuleDef_Slot unicodedata_slots[] = {
{Py_mod_exec, unicodedata_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/xxlimited.c b/Modules/xxlimited.c
index 3357b80..d86741e 100644
--- a/Modules/xxlimited.c
+++ b/Modules/xxlimited.c
@@ -62,10 +62,10 @@
pass
*/
-// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
+// Need limited C API version 3.13 for Py_mod_gil
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
-# define Py_LIMITED_API 0x030c0000
+# define Py_LIMITED_API 0x030d0000
#endif
#include "Python.h"
@@ -395,6 +395,7 @@ xx_modexec(PyObject *m)
static PyModuleDef_Slot xx_slots[] = {
{Py_mod_exec, xx_modexec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
diff --git a/Modules/xxlimited_35.c b/Modules/xxlimited_35.c
index 52690d9..1063e54 100644
--- a/Modules/xxlimited_35.c
+++ b/Modules/xxlimited_35.c
@@ -297,6 +297,10 @@ xx_modexec(PyObject *m)
static PyModuleDef_Slot xx_slots[] = {
{Py_mod_exec, xx_modexec},
+#ifdef Py_GIL_DISABLED
+ // These definitions are in the limited API, but not until 3.13.
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
+#endif
{0, NULL}
};
diff --git a/Modules/xxmodule.c b/Modules/xxmodule.c
index 1e4e0ea..a46bf8f 100644
--- a/Modules/xxmodule.c
+++ b/Modules/xxmodule.c
@@ -384,6 +384,7 @@ xx_exec(PyObject *m)
static struct PyModuleDef_Slot xx_slots[] = {
{Py_mod_exec, xx_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
diff --git a/Modules/xxsubtype.c b/Modules/xxsubtype.c
index 560f43e..9c548f4 100644
--- a/Modules/xxsubtype.c
+++ b/Modules/xxsubtype.c
@@ -288,6 +288,7 @@ xxsubtype_exec(PyObject* m)
static struct PyModuleDef_Slot xxsubtype_slots[] = {
{Py_mod_exec, xxsubtype_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index fe9a6d8..b115f67 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -2106,6 +2106,7 @@ zlib_exec(PyObject *mod)
static PyModuleDef_Slot zlib_slots[] = {
{Py_mod_exec, zlib_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};