gh-128341: Use _Py_ABI_SLOT in stdlib modules (#145770)

Rename from _Py_INTERNAL_ABI_SLOT to _Py_ABI_SLOT
and define the macro using _PyABIInfo_DEFAULT.

Use the ABI slot in stdlib extension modules to enable running
a check of ABI version compatibility.

_tkinter, _tracemalloc and readline don't use the slots, hence they need
explicit handling.

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Karolina SurmaandVictor Stinner authored and GitHub committed 2026-03-24 17:47:55 +00:00
1 parent 119fce7b88
commit 1887a95f51
96 files changed
+128 -10

No files matched your search

+3 -9
View File
@@ -39,13 +39,7 @@ 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
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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}
+1
View File
@@ -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},
+1
View File
@@ -1833,6 +1833,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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1 -1
View File
@@ -7656,7 +7656,7 @@ finally:
}
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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -4533,6 +4533,7 @@ error:
}
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},
+1
View File
@@ -2018,6 +2018,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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -3605,6 +3605,7 @@ error:
}
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},
+1
View File
@@ -1898,6 +1898,7 @@ error:
}
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},
+1
View File
@@ -1634,6 +1634,7 @@ error:
}
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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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}
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -1840,6 +1840,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},
+1
View File
@@ -778,6 +778,7 @@ error:
}
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},
+1
View File
@@ -3466,6 +3466,7 @@ error:
}
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},
+1
View File
@@ -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},
+1
View File
@@ -2881,6 +2881,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},
+1
View File
@@ -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},
+1
View File
@@ -127,6 +127,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}
+15
View File
@@ -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},
+1
View File
@@ -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},
+5
View File
@@ -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();
+5
View File
@@ -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;
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+3
View File
@@ -28,7 +28,10 @@ static PyMethodDef module_methods[] = {
{NULL},
};
PyABIInfo_VAR(abi_info);
static PyModuleDef_Slot module_slots[] = {
{Py_mod_abi, &abi_info},
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
+1
View File
@@ -2795,6 +2795,7 @@ error:
}
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},
+1
View File
@@ -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},
+1
View File
@@ -3324,6 +3324,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},
+1
View File
@@ -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}
+1
View File
@@ -2544,6 +2544,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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -4121,6 +4121,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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -18815,6 +18815,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},
+1
View File
@@ -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},
+1
View File
@@ -2464,6 +2464,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},
+5
View File
@@ -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;
+1
View File
@@ -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},
+1
View File
@@ -2912,6 +2912,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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -9306,6 +9306,7 @@ error:
}
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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+1
View File
@@ -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},
+3
View File
@@ -301,7 +301,10 @@ xxsubtype_exec(PyObject* m)
return 0;
}
PyABIInfo_VAR(abi_info);
static struct PyModuleDef_Slot xxsubtype_slots[] = {
{Py_mod_abi, &abi_info},
{Py_mod_exec, xxsubtype_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
+1
View File
@@ -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},
+1
View File
@@ -14928,6 +14928,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}
+1
View File
@@ -1989,6 +1989,7 @@ class ASTModuleVisitor(PickleVisitor):
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},
+1
View File
@@ -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},
+1
View File
@@ -400,6 +400,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},
+1
View File
@@ -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},
+1
View File
@@ -1626,6 +1626,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},
+1
View File
@@ -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},
+1
View File
@@ -2135,6 +2135,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},