From 1b23d9ffcd324715bd6394a5d79da671f828012f Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Tue, 3 Mar 2026 10:36:34 +0100 Subject: [PATCH 1/2] Define _Py_ABI_SLOT using _PyABIInfo_DEFAULT _PyABIInfo_DEFAULT is available in Include/modsupport.h, there's not need to duplicate the definition here. Rename from _Py_INTERNAL_ABI_SLOT, as it's no longer internal. --- Include/cpython/modsupport.h | 14 ++++---------- Modules/_datetimemodule.c | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Include/cpython/modsupport.h b/Include/cpython/modsupport.h index b9f253e06b31c9..3522a86990c349 100644 --- a/Include/cpython/modsupport.h +++ b/Include/cpython/modsupport.h @@ -38,14 +38,8 @@ typedef struct _PyArg_Parser { PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywordsFast(PyObject *, PyObject *, struct _PyArg_Parser *, ...); -#ifdef Py_BUILD_CORE -// Internal; defined here to avoid explicitly including pycore_modsupport.h -#define _Py_INTERNAL_ABI_SLOT \ - {Py_mod_abi, (void*) &(PyABIInfo) { \ - .abiinfo_major_version = 1, \ - .abiinfo_minor_version = 0, \ - .flags = PyABIInfo_INTERNAL, \ - .build_version = PY_VERSION_HEX, \ - .abi_version = PY_VERSION_HEX }} \ +// For internal use in stdlib. Needs C99 compound literals. +// Defined here to avoid every stdlib module including pycore_modsupport.h +#define _Py_ABI_SLOT \ + {Py_mod_abi, (void*) &(PyABIInfo) _PyABIInfo_DEFAULT} \ /////////////////////////////////////////////////////// -#endif diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index 6b23a5c637a308..b4191d1c75ccf4 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -7656,7 +7656,7 @@ _datetime_exec(PyObject *module) } static PyModuleDef_Slot module_slots[] = { - _Py_INTERNAL_ABI_SLOT, + _Py_ABI_SLOT, {Py_mod_exec, _datetime_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, From 4a2fd0eda697add5a85f0a6cc4e4e11e62510e3c Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Tue, 24 Feb 2026 14:26:32 +0100 Subject: [PATCH 2/2] Use the ABI slot in stdlib modules This enables running a check of ABI version compatibility. _tkinter, _tracemalloc and readline don't use the slots, hence they need explicit handling. --- Include/cpython/modsupport.h | 4 +--- Modules/_abc.c | 1 + Modules/_asynciomodule.c | 1 + Modules/_bisectmodule.c | 1 + Modules/_bz2module.c | 1 + Modules/_codecsmodule.c | 1 + Modules/_collectionsmodule.c | 1 + Modules/_csv.c | 1 + Modules/_ctypes/_ctypes.c | 1 + Modules/_curses_panel.c | 1 + Modules/_cursesmodule.c | 1 + Modules/_dbmmodule.c | 1 + Modules/_decimal/_decimal.c | 1 + Modules/_elementtree.c | 1 + Modules/_functoolsmodule.c | 1 + Modules/_gdbmmodule.c | 1 + Modules/_hashopenssl.c | 1 + Modules/_heapqmodule.c | 1 + Modules/_interpchannelsmodule.c | 1 + Modules/_interpqueuesmodule.c | 1 + Modules/_interpretersmodule.c | 1 + Modules/_io/_iomodule.c | 1 + Modules/_json.c | 1 + Modules/_localemodule.c | 1 + Modules/_lsprof.c | 1 + Modules/_lzmamodule.c | 1 + Modules/_multiprocessing/multiprocessing.c | 1 + Modules/_opcode.c | 1 + Modules/_operator.c | 1 + Modules/_pickle.c | 1 + Modules/_posixsubprocess.c | 1 + Modules/_queuemodule.c | 1 + Modules/_randommodule.c | 1 + Modules/_remote_debugging/module.c | 1 + Modules/_sqlite/module.c | 1 + Modules/_sre/sre.c | 1 + Modules/_ssl.c | 1 + Modules/_struct.c | 1 + Modules/_suggestions.c | 1 + Modules/_sysconfig.c | 1 + Modules/_testcapimodule.c | 1 + Modules/_testinternalcapi.c | 1 + Modules/_testmultiphase.c | 15 +++++++++++++++ Modules/_threadmodule.c | 1 + Modules/_tkinter.c | 5 +++++ Modules/_tracemalloc.c | 5 +++++ Modules/_typesmodule.c | 1 + Modules/_typingmodule.c | 1 + Modules/_weakref.c | 1 + Modules/_winapi.c | 1 + Modules/_xxtestfuzz/_xxtestfuzz.c | 1 + Modules/_zoneinfo.c | 1 + Modules/_zstd/_zstdmodule.c | 1 + Modules/arraymodule.c | 1 + Modules/atexitmodule.c | 1 + Modules/binascii.c | 1 + Modules/blake2module.c | 1 + Modules/cjkcodecs/cjkcodecs.h | 1 + Modules/cjkcodecs/multibytecodec.c | 1 + Modules/cmathmodule.c | 1 + Modules/faulthandler.c | 1 + Modules/fcntlmodule.c | 1 + Modules/gcmodule.c | 1 + Modules/grpmodule.c | 1 + Modules/hmacmodule.c | 1 + Modules/itertoolsmodule.c | 1 + Modules/mathintegermodule.c | 1 + Modules/mathmodule.c | 1 + Modules/md5module.c | 1 + Modules/mmapmodule.c | 1 + Modules/overlapped.c | 1 + Modules/posixmodule.c | 1 + Modules/pwdmodule.c | 1 + Modules/pyexpat.c | 1 + Modules/readline.c | 5 +++++ Modules/resource.c | 1 + Modules/selectmodule.c | 1 + Modules/sha1module.c | 1 + Modules/sha2module.c | 1 + Modules/sha3module.c | 1 + Modules/signalmodule.c | 1 + Modules/socketmodule.c | 1 + Modules/symtablemodule.c | 1 + Modules/syslogmodule.c | 1 + Modules/timemodule.c | 1 + Modules/unicodedata.c | 1 + Modules/xxmodule.c | 1 + Modules/xxsubtype.c | 1 + Modules/zlibmodule.c | 1 + Objects/unicodeobject.c | 1 + Parser/asdl_c.py | 1 + Python/Python-ast.c | 1 + Python/Python-tokenize.c | 1 + Python/_contextvars.c | 1 + Python/_warnings.c | 1 + Python/import.c | 1 + Python/marshal.c | 1 + 97 files changed, 123 insertions(+), 3 deletions(-) diff --git a/Include/cpython/modsupport.h b/Include/cpython/modsupport.h index 3522a86990c349..c54e11a6c08423 100644 --- a/Include/cpython/modsupport.h +++ b/Include/cpython/modsupport.h @@ -40,6 +40,4 @@ PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywordsFast(PyObject *, PyObject *, // For internal use in stdlib. Needs C99 compound literals. // Defined here to avoid every stdlib module including pycore_modsupport.h -#define _Py_ABI_SLOT \ - {Py_mod_abi, (void*) &(PyABIInfo) _PyABIInfo_DEFAULT} \ - /////////////////////////////////////////////////////// +#define _Py_ABI_SLOT {Py_mod_abi, (void*) &(PyABIInfo) _PyABIInfo_DEFAULT} diff --git a/Modules/_abc.c b/Modules/_abc.c index f87a5c702946bc..3c4e0280525e1e 100644 --- a/Modules/_abc.c +++ b/Modules/_abc.c @@ -976,6 +976,7 @@ _abcmodule_free(void *module) } static PyModuleDef_Slot _abcmodule_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _abcmodule_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 8eb8e191530a33..826c0b25a362c2 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -4394,6 +4394,7 @@ module_exec(PyObject *mod) } static struct PyModuleDef_Slot module_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, module_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_bisectmodule.c b/Modules/_bisectmodule.c index 3a1491e5b96f29..329aa8e117ec3c 100644 --- a/Modules/_bisectmodule.c +++ b/Modules/_bisectmodule.c @@ -452,6 +452,7 @@ bisect_modexec(PyObject *m) } static PyModuleDef_Slot bisect_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, bisect_modexec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_bz2module.c b/Modules/_bz2module.c index f3457a13c96c1f..7b8cbf3ed96184 100644 --- a/Modules/_bz2module.c +++ b/Modules/_bz2module.c @@ -783,6 +783,7 @@ _bz2_free(void *module) } static struct PyModuleDef_Slot _bz2_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _bz2_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_codecsmodule.c b/Modules/_codecsmodule.c index 2f2edbb05ab5c5..ff52bfd8291ac1 100644 --- a/Modules/_codecsmodule.c +++ b/Modules/_codecsmodule.c @@ -1113,6 +1113,7 @@ static PyMethodDef _codecs_functions[] = { }; static PyModuleDef_Slot _codecs_slots[] = { + _Py_ABI_SLOT, {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 15c9aa41911822..4ff05727ebc8ce 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -2873,6 +2873,7 @@ collections_exec(PyObject *module) { #undef ADD_TYPE static struct PyModuleDef_Slot collections_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, collections_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_csv.c b/Modules/_csv.c index 1f41976e95fdb1..88d2d9a833f6a1 100644 --- a/Modules/_csv.c +++ b/Modules/_csv.c @@ -1829,6 +1829,7 @@ csv_exec(PyObject *module) { } static PyModuleDef_Slot csv_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, csv_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 2c691c3766fc4d..9a6f377fdb0ed5 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -6497,6 +6497,7 @@ module_free(void *module) } static PyModuleDef_Slot module_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _ctypes_mod_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c index 3b46fdf838b16f..83802605e1f4dc 100644 --- a/Modules/_curses_panel.c +++ b/Modules/_curses_panel.c @@ -845,6 +845,7 @@ _curses_panel_exec(PyObject *mod) } static PyModuleDef_Slot _curses_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _curses_panel_exec}, // XXX gh-103092: fix isolation. {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}, diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index fe9d6fe2763f36..000d7318557a6e 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -5631,6 +5631,7 @@ cursesmodule_exec(PyObject *module) /* Initialization function for the module */ static PyModuleDef_Slot cursesmodule_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, cursesmodule_exec}, {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_dbmmodule.c b/Modules/_dbmmodule.c index f88861fa24423b..6b07ef74cfa51d 100644 --- a/Modules/_dbmmodule.c +++ b/Modules/_dbmmodule.c @@ -674,6 +674,7 @@ _dbm_module_free(void *module) } static PyModuleDef_Slot _dbmmodule_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _dbm_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c index c42757e042e7ef..b47014c4e7466d 100644 --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -8029,6 +8029,7 @@ decimal_free(void *module) } static struct PyModuleDef_Slot _decimal_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _decimal_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index e0bc69c5fe22f8..99e899a786ae81 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -4530,6 +4530,7 @@ module_exec(PyObject *m) } static struct PyModuleDef_Slot elementtree_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, module_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c index 336a2e57ec0179..f6fc30db4b8d98 100644 --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -2004,6 +2004,7 @@ _functools_free(void *module) } static struct PyModuleDef_Slot _functools_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _functools_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_gdbmmodule.c b/Modules/_gdbmmodule.c index 72f568ceb06987..faffe8d28c5b5e 100644 --- a/Modules/_gdbmmodule.c +++ b/Modules/_gdbmmodule.c @@ -912,6 +912,7 @@ _gdbm_module_free(void *module) } static PyModuleDef_Slot _gdbm_module_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _gdbm_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c index e19eb1abcf2c4d..938a6ce5b962d1 100644 --- a/Modules/_hashopenssl.c +++ b/Modules/_hashopenssl.c @@ -2899,6 +2899,7 @@ hashlib_constants(PyObject *module) } static PyModuleDef_Slot hashlib_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, hashlib_init_hashtable}, {Py_mod_exec, hashlib_init_HASH_type}, {Py_mod_exec, hashlib_init_HASHXOF_type}, diff --git a/Modules/_heapqmodule.c b/Modules/_heapqmodule.c index 05d01acd77109b..c705376f4edbf0 100644 --- a/Modules/_heapqmodule.c +++ b/Modules/_heapqmodule.c @@ -786,6 +786,7 @@ heapq_exec(PyObject *m) } static struct PyModuleDef_Slot heapq_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, heapq_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_interpchannelsmodule.c b/Modules/_interpchannelsmodule.c index 2933332ad465d4..3c356cb40d2bca 100644 --- a/Modules/_interpchannelsmodule.c +++ b/Modules/_interpchannelsmodule.c @@ -3605,6 +3605,7 @@ module_exec(PyObject *mod) } static struct PyModuleDef_Slot module_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, module_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_interpqueuesmodule.c b/Modules/_interpqueuesmodule.c index 417c5fbcee2645..777b6854749884 100644 --- a/Modules/_interpqueuesmodule.c +++ b/Modules/_interpqueuesmodule.c @@ -1898,6 +1898,7 @@ module_exec(PyObject *mod) } static struct PyModuleDef_Slot module_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, module_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_interpretersmodule.c b/Modules/_interpretersmodule.c index 2aee8b07891c91..b65140e003b9c9 100644 --- a/Modules/_interpretersmodule.c +++ b/Modules/_interpretersmodule.c @@ -1634,6 +1634,7 @@ module_exec(PyObject *mod) } static struct PyModuleDef_Slot module_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, module_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c index 433d68d515ccc6..32c55f8e225ed9 100644 --- a/Modules/_io/_iomodule.c +++ b/Modules/_io/_iomodule.c @@ -722,6 +722,7 @@ iomodule_exec(PyObject *m) } static struct PyModuleDef_Slot iomodule_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, iomodule_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_json.c b/Modules/_json.c index cbede8f44dc065..f9c4f06bac7b43 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -2087,6 +2087,7 @@ _json_exec(PyObject *module) } static PyModuleDef_Slot _json_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _json_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index 86a390e52a554b..8f7d662b00b21b 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -1052,6 +1052,7 @@ _locale_exec(PyObject *module) } static struct PyModuleDef_Slot _locale_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _locale_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_lsprof.c b/Modules/_lsprof.c index a2d1aefb1611b3..abb8db1acabbd5 100644 --- a/Modules/_lsprof.c +++ b/Modules/_lsprof.c @@ -1125,6 +1125,7 @@ _lsprof_exec(PyObject *module) } static PyModuleDef_Slot _lsprofslots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _lsprof_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_lzmamodule.c b/Modules/_lzmamodule.c index cd0d09682fac69..3c391675d7b93e 100644 --- a/Modules/_lzmamodule.c +++ b/Modules/_lzmamodule.c @@ -1594,6 +1594,7 @@ static PyMethodDef lzma_methods[] = { }; static PyModuleDef_Slot lzma_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, lzma_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_multiprocessing/multiprocessing.c b/Modules/_multiprocessing/multiprocessing.c index 848784dedc1702..201cedbb59818f 100644 --- a/Modules/_multiprocessing/multiprocessing.c +++ b/Modules/_multiprocessing/multiprocessing.c @@ -274,6 +274,7 @@ multiprocessing_exec(PyObject *module) } static PyModuleDef_Slot multiprocessing_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, multiprocessing_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_opcode.c b/Modules/_opcode.c index 2fe09593a457e9..dedf17f76dfc9b 100644 --- a/Modules/_opcode.c +++ b/Modules/_opcode.c @@ -427,6 +427,7 @@ _opcode_exec(PyObject *m) { } static PyModuleDef_Slot module_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _opcode_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_operator.c b/Modules/_operator.c index 1cc05c39f5dbad..d04732dc314f11 100644 --- a/Modules/_operator.c +++ b/Modules/_operator.c @@ -1981,6 +1981,7 @@ operator_exec(PyObject *module) static struct PyModuleDef_Slot operator_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, operator_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 65facaa6db2036..a55e04290b8fdd 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -8240,6 +8240,7 @@ _pickle_exec(PyObject *m) } static PyModuleDef_Slot pickle_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _pickle_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c index 6f0a6d1d4e37fe..b7f39ea3d499e4 100644 --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -1337,6 +1337,7 @@ static PyMethodDef module_methods[] = { }; static PyModuleDef_Slot _posixsubprocess_slots[] = { + _Py_ABI_SLOT, {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 f2246dd36cf110..ed925f3525a9a7 100644 --- a/Modules/_queuemodule.c +++ b/Modules/_queuemodule.c @@ -617,6 +617,7 @@ queuemodule_exec(PyObject *module) } static PyModuleDef_Slot queuemodule_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, queuemodule_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c index 544e636d18fede..0fb73481651748 100644 --- a/Modules/_randommodule.c +++ b/Modules/_randommodule.c @@ -643,6 +643,7 @@ _random_exec(PyObject *module) } static PyModuleDef_Slot _random_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _random_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_remote_debugging/module.c b/Modules/_remote_debugging/module.c index 040bd3db377315..357555fc4aae4b 100644 --- a/Modules/_remote_debugging/module.c +++ b/Modules/_remote_debugging/module.c @@ -1831,6 +1831,7 @@ static PyMethodDef remote_debugging_methods[] = { }; static PyModuleDef_Slot remote_debugging_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _remote_debugging_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c index 831dd9219f77ab..512d9744d57416 100644 --- a/Modules/_sqlite/module.c +++ b/Modules/_sqlite/module.c @@ -778,6 +778,7 @@ module_exec(PyObject *module) } static struct PyModuleDef_Slot module_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, module_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_sre/sre.c b/Modules/_sre/sre.c index d6cdd861fd85a2..54de09a7d773dc 100644 --- a/Modules/_sre/sre.c +++ b/Modules/_sre/sre.c @@ -3466,6 +3466,7 @@ sre_exec(PyObject *m) } static PyModuleDef_Slot sre_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, sre_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 2eb31229a9bf3c..b45295b4c0cad7 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -7312,6 +7312,7 @@ sslmodule_init_lock(PyObject *module) } static PyModuleDef_Slot sslmodule_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, sslmodule_init_types}, {Py_mod_exec, sslmodule_init_exceptions}, {Py_mod_exec, sslmodule_init_socketapi}, diff --git a/Modules/_struct.c b/Modules/_struct.c index dcc3c7ec63e9e0..959a8d8d9b9c3e 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -2753,6 +2753,7 @@ _structmodule_exec(PyObject *m) } static PyModuleDef_Slot _structmodule_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _structmodule_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_suggestions.c b/Modules/_suggestions.c index fb588de78085fe..db1efa7841f995 100644 --- a/Modules/_suggestions.c +++ b/Modules/_suggestions.c @@ -51,6 +51,7 @@ static PyMethodDef module_methods[] = { }; static PyModuleDef_Slot module_slots[] = { + _Py_ABI_SLOT, {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, {0, NULL}, diff --git a/Modules/_sysconfig.c b/Modules/_sysconfig.c index 345498e670dd6a..42c4fa36486013 100644 --- a/Modules/_sysconfig.c +++ b/Modules/_sysconfig.c @@ -90,6 +90,7 @@ static struct PyMethodDef sysconfig_methods[] = { }; static PyModuleDef_Slot sysconfig_slots[] = { + _Py_ABI_SLOT, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, {0, NULL} diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index c0ab35cda191c8..2d9cd078ac6b79 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -3532,6 +3532,7 @@ _testcapi_exec(PyObject *m) PyABIInfo_VAR(abi_info); static PyModuleDef_Slot _testcapi_slots[] = { + _Py_ABI_SLOT, {Py_mod_abi, &abi_info}, {Py_mod_exec, _testcapi_exec}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_testinternalcapi.c b/Modules/_testinternalcapi.c index aa5911ef2fb449..10afc9abb1ec3a 100644 --- a/Modules/_testinternalcapi.c +++ b/Modules/_testinternalcapi.c @@ -3048,6 +3048,7 @@ module_exec(PyObject *module) PyABIInfo_VAR(abi_info); static struct PyModuleDef_Slot module_slots[] = { + _Py_ABI_SLOT, {Py_mod_abi, &abi_info}, {Py_mod_exec, module_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, diff --git a/Modules/_testmultiphase.c b/Modules/_testmultiphase.c index e286eaae820b2b..4921dc90713daf 100644 --- a/Modules/_testmultiphase.c +++ b/Modules/_testmultiphase.c @@ -435,6 +435,7 @@ static int execfunc(PyObject *m) } static PyModuleDef_Slot main_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, execfunc}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, @@ -481,6 +482,7 @@ createfunc_nonmodule(PyObject *spec, PyModuleDef *def) } static PyModuleDef_Slot slots_create_nonmodule[] = { + _Py_ABI_SLOT, {Py_mod_create, createfunc_nonmodule}, {0, NULL}, }; @@ -527,6 +529,7 @@ PyInit__testmultiphase_nonmodule_with_methods(void) /**** Non-ASCII-named modules ****/ static PyModuleDef_Slot nonascii_slots[] = { + _Py_ABI_SLOT, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, {0, NULL}, }; @@ -689,6 +692,7 @@ createfunc_noop(PyObject *spec, PyModuleDef *def) } static PyModuleDef_Slot slots_multiple_create_slots[] = { + _Py_ABI_SLOT, {Py_mod_create, createfunc_noop}, {Py_mod_create, createfunc_noop}, {0, NULL}, @@ -710,6 +714,7 @@ createfunc_null(PyObject *spec, PyModuleDef *def) } static PyModuleDef_Slot slots_create_null[] = { + _Py_ABI_SLOT, {Py_mod_create, createfunc_null}, {0, NULL}, }; @@ -752,6 +757,7 @@ createfunc_unreported_exception(PyObject *spec, PyModuleDef *def) } static PyModuleDef_Slot slots_create_unreported_exception[] = { + _Py_ABI_SLOT, {Py_mod_create, createfunc_unreported_exception}, {0, NULL}, }; @@ -766,6 +772,7 @@ PyInit__testmultiphase_create_unreported_exception(void) } static PyModuleDef_Slot slots_nonmodule_with_exec_slots[] = { + _Py_ABI_SLOT, {Py_mod_create, createfunc_nonmodule}, {Py_mod_exec, execfunc}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, @@ -789,6 +796,7 @@ execfunc_err(PyObject *mod) } static PyModuleDef_Slot slots_exec_err[] = { + _Py_ABI_SLOT, {Py_mod_exec, execfunc_err}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, @@ -812,6 +820,7 @@ execfunc_raise(PyObject *spec) } static PyModuleDef_Slot slots_exec_raise[] = { + _Py_ABI_SLOT, {Py_mod_exec, execfunc_raise}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, @@ -835,6 +844,7 @@ execfunc_unreported_exception(PyObject *mod) } static PyModuleDef_Slot slots_exec_unreported_exception[] = { + _Py_ABI_SLOT, {Py_mod_exec, execfunc_unreported_exception}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, @@ -893,6 +903,7 @@ meth_state_access_exec(PyObject *m) } static PyModuleDef_Slot meth_state_access_slots[] = { + _Py_ABI_SLOT, {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}, @@ -943,6 +954,7 @@ PyInit__test_module_state_shared(void) /* multiple interpreters support */ static PyModuleDef_Slot slots_multiple_multiple_interpreters_slots[] = { + _Py_ABI_SLOT, {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}, @@ -961,6 +973,7 @@ PyInit__testmultiphase_multiple_multiple_interpreters_slots(void) } static PyModuleDef_Slot non_isolated_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, execfunc}, {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, @@ -979,6 +992,7 @@ PyInit__test_non_isolated(void) static PyModuleDef_Slot shared_gil_only_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, execfunc}, /* Note that Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED is the default. We put it here explicitly to draw attention to the contrast @@ -1000,6 +1014,7 @@ PyInit__test_shared_gil_only(void) static PyModuleDef_Slot no_multiple_interpreter_slot_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, execfunc}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, {0, NULL}, diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index 73eff27343618c..529257c2aa78aa 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -2857,6 +2857,7 @@ PyDoc_STRVAR(thread_doc, The 'threading' module provides a more convenient interface."); static PyModuleDef_Slot thread_module_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, thread_module_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 1524d02d9e5a5e..bbe2a428454e0c 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -3476,6 +3476,11 @@ static struct PyModuleDef _tkintermodule = { PyMODINIT_FUNC PyInit__tkinter(void) { + PyABIInfo_VAR(abi_info); + if (PyABIInfo_Check(&abi_info, "_tkinter") < 0) { + return NULL; + } + PyObject *m, *uexe, *cexe; tcl_lock = PyThread_allocate_lock(); diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index 21baa6ea003884..56d83ea0dcb2a7 100644 --- a/Modules/_tracemalloc.c +++ b/Modules/_tracemalloc.c @@ -216,6 +216,11 @@ static struct PyModuleDef module_def = { PyMODINIT_FUNC PyInit__tracemalloc(void) { + PyABIInfo_VAR(abi_info); + if (PyABIInfo_Check(&abi_info, "_tracemalloc") < 0) { + return NULL; + } + PyObject *mod = PyModule_Create(&module_def); if (mod == NULL) { return NULL; diff --git a/Modules/_typesmodule.c b/Modules/_typesmodule.c index 6c9e7a0a3ba053..232c6cd46d1aa8 100644 --- a/Modules/_typesmodule.c +++ b/Modules/_typesmodule.c @@ -54,6 +54,7 @@ _types_exec(PyObject *m) } static struct PyModuleDef_Slot _typesmodule_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _types_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_typingmodule.c b/Modules/_typingmodule.c index e51279c808a2e1..9f698d3e48d5f0 100644 --- a/Modules/_typingmodule.c +++ b/Modules/_typingmodule.c @@ -74,6 +74,7 @@ _typing_exec(PyObject *m) } static struct PyModuleDef_Slot _typingmodule_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _typing_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_weakref.c b/Modules/_weakref.c index ecaa08ff60f203..623252728554f7 100644 --- a/Modules/_weakref.c +++ b/Modules/_weakref.c @@ -162,6 +162,7 @@ weakref_exec(PyObject *module) } static struct PyModuleDef_Slot weakref_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, weakref_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_winapi.c b/Modules/_winapi.c index 985706737c5a36..ffa407b2f21f73 100644 --- a/Modules/_winapi.c +++ b/Modules/_winapi.c @@ -3328,6 +3328,7 @@ static int winapi_exec(PyObject *m) } static PyModuleDef_Slot winapi_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, winapi_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_xxtestfuzz/_xxtestfuzz.c b/Modules/_xxtestfuzz/_xxtestfuzz.c index 0e0ca5f95fa449..56668e48a95eda 100644 --- a/Modules/_xxtestfuzz/_xxtestfuzz.c +++ b/Modules/_xxtestfuzz/_xxtestfuzz.c @@ -29,6 +29,7 @@ static PyMethodDef module_methods[] = { }; static PyModuleDef_Slot module_slots[] = { + _Py_ABI_SLOT, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, {0, NULL}, }; diff --git a/Modules/_zoneinfo.c b/Modules/_zoneinfo.c index 39671d1ab51dfa..455af60c5f8acb 100644 --- a/Modules/_zoneinfo.c +++ b/Modules/_zoneinfo.c @@ -2776,6 +2776,7 @@ zoneinfomodule_exec(PyObject *m) } static PyModuleDef_Slot zoneinfomodule_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, zoneinfomodule_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/_zstd/_zstdmodule.c b/Modules/_zstd/_zstdmodule.c index 25ededd03a380a..94246dd93b17de 100644 --- a/Modules/_zstd/_zstdmodule.c +++ b/Modules/_zstd/_zstdmodule.c @@ -744,6 +744,7 @@ _zstd_free(void *module) } static struct PyModuleDef_Slot _zstd_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _zstd_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index ec6a9840131e4d..097fbb7ff023d0 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -3326,6 +3326,7 @@ array_modexec(PyObject *m) } static PyModuleDef_Slot arrayslots[] = { + _Py_ABI_SLOT, {Py_mod_exec, array_modexec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/atexitmodule.c b/Modules/atexitmodule.c index 3ddbbd59a1ef0c..177b09d3dafbd9 100644 --- a/Modules/atexitmodule.c +++ b/Modules/atexitmodule.c @@ -341,6 +341,7 @@ Two public functions, register and unregister, are defined.\n\ "); static PyModuleDef_Slot atexitmodule_slots[] = { + _Py_ABI_SLOT, {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 3f3695d50f2754..27e36c625a126d 100644 --- a/Modules/binascii.c +++ b/Modules/binascii.c @@ -2045,6 +2045,7 @@ binascii_exec(PyObject *module) } static PyModuleDef_Slot binascii_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, binascii_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/blake2module.c b/Modules/blake2module.c index 89b0ebd516f693..3bccc89c26e53a 100644 --- a/Modules/blake2module.c +++ b/Modules/blake2module.c @@ -280,6 +280,7 @@ blake2_exec(PyObject *m) } static PyModuleDef_Slot _blake2_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, blake2_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/cjkcodecs/cjkcodecs.h b/Modules/cjkcodecs/cjkcodecs.h index f66412237011d4..9d86396f73b2b5 100644 --- a/Modules/cjkcodecs/cjkcodecs.h +++ b/Modules/cjkcodecs/cjkcodecs.h @@ -500,6 +500,7 @@ static struct PyMethodDef _cjk_methods[] = { }; static PyModuleDef_Slot _cjk_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _cjk_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c index a7fac2380f2519..d774a4968b8836 100644 --- a/Modules/cjkcodecs/multibytecodec.c +++ b/Modules/cjkcodecs/multibytecodec.c @@ -2121,6 +2121,7 @@ static struct PyMethodDef _multibytecodec_methods[] = { }; static PyModuleDef_Slot _multibytecodec_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _multibytecodec_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/cmathmodule.c b/Modules/cmathmodule.c index 65fbcf5cdaa73f..1e9f9ae051a0b1 100644 --- a/Modules/cmathmodule.c +++ b/Modules/cmathmodule.c @@ -1293,6 +1293,7 @@ cmath_exec(PyObject *mod) } static PyModuleDef_Slot cmath_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, cmath_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c index 9b8c77e2b0401f..bc7731c2588dc0 100644 --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -1422,6 +1422,7 @@ PyExec_faulthandler(PyObject *module) { } static PyModuleDef_Slot faulthandler_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, PyExec_faulthandler}, // XXX gh-103092: fix isolation. //{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c index ce636c574ed5ff..e6a40ffc5a2614 100644 --- a/Modules/fcntlmodule.c +++ b/Modules/fcntlmodule.c @@ -835,6 +835,7 @@ fcntl_exec(PyObject *module) } static PyModuleDef_Slot fcntl_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, fcntl_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 4c286f5c12cc7d..0da8cd5b418aca 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -538,6 +538,7 @@ gcmodule_exec(PyObject *module) } static PyModuleDef_Slot gcmodule_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, gcmodule_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c index 652958618a2c4c..32ead259803614 100644 --- a/Modules/grpmodule.c +++ b/Modules/grpmodule.c @@ -370,6 +370,7 @@ grpmodule_exec(PyObject *module) } static PyModuleDef_Slot grpmodule_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, grpmodule_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/hmacmodule.c b/Modules/hmacmodule.c index 1a212fa3d37e18..b39a8f99ed91e8 100644 --- a/Modules/hmacmodule.c +++ b/Modules/hmacmodule.c @@ -1690,6 +1690,7 @@ hmacmodule_free(void *mod) } static struct PyModuleDef_Slot hmacmodule_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, hmacmodule_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index bc25bf6bfc1bd2..e174ecf10f8554 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -4111,6 +4111,7 @@ itertoolsmodule_exec(PyObject *mod) } static struct PyModuleDef_Slot itertoolsmodule_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, itertoolsmodule_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/mathintegermodule.c b/Modules/mathintegermodule.c index de5f619c9d065c..cfad4154b2d361 100644 --- a/Modules/mathintegermodule.c +++ b/Modules/mathintegermodule.c @@ -1268,6 +1268,7 @@ math_integer_exec(PyObject *module) } static PyModuleDef_Slot math_integer_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, math_integer_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index 11c46c987e146a..6b7fc004d0d858 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -3103,6 +3103,7 @@ static PyMethodDef math_methods[] = { }; static PyModuleDef_Slot math_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, math_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/md5module.c b/Modules/md5module.c index e598b1fe67240d..063be1405dd51f 100644 --- a/Modules/md5module.c +++ b/Modules/md5module.c @@ -365,6 +365,7 @@ md5_exec(PyObject *m) } static PyModuleDef_Slot _md5_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, md5_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 61d8a043a04ce2..a30afe91f8fa17 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -2432,6 +2432,7 @@ mmap_exec(PyObject *module) } static PyModuleDef_Slot mmap_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, mmap_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/overlapped.c b/Modules/overlapped.c index 8c3575ff5678eb..8d2bd87ddb3c2e 100644 --- a/Modules/overlapped.c +++ b/Modules/overlapped.c @@ -2073,6 +2073,7 @@ overlapped_exec(PyObject *module) } static PyModuleDef_Slot overlapped_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, overlapped_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index aa3d682a19bc9c..b0c9fafcbf4061 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -18813,6 +18813,7 @@ posixmodule_exec(PyObject *m) static PyModuleDef_Slot posixmodile_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, posixmodule_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c index a18737b24c29e9..4a2b33f8700d10 100644 --- a/Modules/pwdmodule.c +++ b/Modules/pwdmodule.c @@ -372,6 +372,7 @@ pwdmodule_exec(PyObject *module) } static PyModuleDef_Slot pwdmodule_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, pwdmodule_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index e9255038eee5b5..abc41e76958658 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -2462,6 +2462,7 @@ pyexpat_free(void *module) } static PyModuleDef_Slot pyexpat_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, pyexpat_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/readline.c b/Modules/readline.c index 579a34b02ceb67..488332f548e5fe 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -1626,6 +1626,11 @@ static struct PyModuleDef readlinemodule = { PyMODINIT_FUNC PyInit_readline(void) { + PyABIInfo_VAR(abi_info); + if (PyABIInfo_Check(&abi_info, "readline") < 0) { + return NULL; + } + const char *backend = "readline"; PyObject *m; readlinestate *mod_state; diff --git a/Modules/resource.c b/Modules/resource.c index a463355f424d48..9bf8d2782766cc 100644 --- a/Modules/resource.c +++ b/Modules/resource.c @@ -560,6 +560,7 @@ resource_exec(PyObject *module) } static struct PyModuleDef_Slot resource_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, resource_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index 137bf2ca55bbf8..e7cdf17376ce25 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -2909,6 +2909,7 @@ _select_exec(PyObject *m) } static PyModuleDef_Slot _select_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _select_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/sha1module.c b/Modules/sha1module.c index 89e66240d1d11f..5681780b569b6c 100644 --- a/Modules/sha1module.c +++ b/Modules/sha1module.c @@ -369,6 +369,7 @@ _sha1_exec(PyObject *module) /* Initialize this module. */ static PyModuleDef_Slot _sha1_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _sha1_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/sha2module.c b/Modules/sha2module.c index 9453b0be512555..7613ee54954dd6 100644 --- a/Modules/sha2module.c +++ b/Modules/sha2module.c @@ -883,6 +883,7 @@ static int sha2_exec(PyObject *module) } static PyModuleDef_Slot _sha2_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, sha2_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/sha3module.c b/Modules/sha3module.c index 38c9bc0405be60..3ddd0323575b70 100644 --- a/Modules/sha3module.c +++ b/Modules/sha3module.c @@ -680,6 +680,7 @@ _sha3_exec(PyObject *m) } static PyModuleDef_Slot _sha3_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _sha3_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index 5060e4097d33c9..42ec786f953ab6 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -1709,6 +1709,7 @@ _signal_module_free(void *module) static PyModuleDef_Slot signal_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, signal_module_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index d4df40c78e8a4f..53d78a646bb84c 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -9305,6 +9305,7 @@ socket_exec(PyObject *m) } static struct PyModuleDef_Slot socket_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, socket_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/symtablemodule.c b/Modules/symtablemodule.c index a24927a9db64db..e9e1c4811b8303 100644 --- a/Modules/symtablemodule.c +++ b/Modules/symtablemodule.c @@ -122,6 +122,7 @@ symtable_init_constants(PyObject *m) } static PyModuleDef_Slot symtable_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, symtable_init_constants}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c index 5d7fd20c4e0999..2d13f9eda758dd 100644 --- a/Modules/syslogmodule.c +++ b/Modules/syslogmodule.c @@ -451,6 +451,7 @@ syslog_exec(PyObject *module) } static PyModuleDef_Slot syslog_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, syslog_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/timemodule.c b/Modules/timemodule.c index a3260e0f15ab99..25e744d7da25c7 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -2185,6 +2185,7 @@ time_module_free(void *module) static struct PyModuleDef_Slot time_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, time_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c index 2c67c23d98ed81..55b33a76e7af8a 100644 --- a/Modules/unicodedata.c +++ b/Modules/unicodedata.c @@ -2303,6 +2303,7 @@ unicodedata_exec(PyObject *module) } static PyModuleDef_Slot unicodedata_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, unicodedata_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/xxmodule.c b/Modules/xxmodule.c index e8749331c6a11f..aeab78fd77d83b 100644 --- a/Modules/xxmodule.c +++ b/Modules/xxmodule.c @@ -386,6 +386,7 @@ xx_exec(PyObject *m) } static struct PyModuleDef_Slot xx_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, xx_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/xxsubtype.c b/Modules/xxsubtype.c index a8a1417f40efef..1d06b0faa0e4a9 100644 --- a/Modules/xxsubtype.c +++ b/Modules/xxsubtype.c @@ -302,6 +302,7 @@ xxsubtype_exec(PyObject* m) } static struct PyModuleDef_Slot xxsubtype_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, xxsubtype_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c index f546f3ff1cb864..53329b068b4124 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -2272,6 +2272,7 @@ zlib_exec(PyObject *mod) } static PyModuleDef_Slot zlib_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, zlib_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index a65c43874e876c..ed78420eb28ea2 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -14931,6 +14931,7 @@ static PyMethodDef _string_methods[] = { }; static PyModuleDef_Slot module_slots[] = { + _Py_ABI_SLOT, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, {0, NULL} diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index 5ad20d49fa4b31..71a164fbec5a06 100755 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -1989,6 +1989,7 @@ def visitModule(self, mod): self.emit("", 0) self.emit(""" static PyModuleDef_Slot astmodule_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, astmodule_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 5d319992dcda1e..dad1530e343a38 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -18480,6 +18480,7 @@ astmodule_exec(PyObject *m) } static PyModuleDef_Slot astmodule_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, astmodule_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Python/Python-tokenize.c b/Python/Python-tokenize.c index 152d61c686722e..c402cc4bba6947 100644 --- a/Python/Python-tokenize.c +++ b/Python/Python-tokenize.c @@ -399,6 +399,7 @@ static PyMethodDef tokenize_methods[] = { }; static PyModuleDef_Slot tokenizemodule_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, tokenizemodule_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Python/_contextvars.c b/Python/_contextvars.c index 0f8b8004c1af22..86acc94fbc79cd 100644 --- a/Python/_contextvars.c +++ b/Python/_contextvars.c @@ -43,6 +43,7 @@ _contextvars_exec(PyObject *m) } static struct PyModuleDef_Slot _contextvars_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, _contextvars_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Python/_warnings.c b/Python/_warnings.c index 0ea785772f03b9..b7eed3dc276a8d 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -1625,6 +1625,7 @@ warnings_module_exec(PyObject *module) static PyModuleDef_Slot warnings_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, warnings_module_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Python/import.c b/Python/import.c index 34224f4c6d6514..f615fe37ba8fbe 100644 --- a/Python/import.c +++ b/Python/import.c @@ -5714,6 +5714,7 @@ imp_module_exec(PyObject *module) static PyModuleDef_Slot imp_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, imp_module_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, diff --git a/Python/marshal.c b/Python/marshal.c index 59db6456552c35..8faee2dc221d3f 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -2136,6 +2136,7 @@ marshal_module_exec(PyObject *mod) } static PyModuleDef_Slot marshalmodule_slots[] = { + _Py_ABI_SLOT, {Py_mod_exec, marshal_module_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED},