Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-99113: Add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED #104205

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Include/moduleobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ struct PyModuleDef_Slot {
/* for Py_mod_multiple_interpreters: */
#define Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED ((void *)0)
#define Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED ((void *)1)
#define Py_MOD_PER_INTERPRETER_GIL_SUPPORTED ((void *)2)

#endif /* New in 3.5 */

Expand Down
1 change: 1 addition & 0 deletions Modules/_abc.c
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,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},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3803,6 +3803,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},
{0, NULL},
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_bisectmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,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},
{0, NULL}
};

Expand Down
3 changes: 2 additions & 1 deletion Modules/_blake2/blake2module.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,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},
{0, NULL}
};

Expand All @@ -146,4 +147,4 @@ PyMODINIT_FUNC
PyInit__blake2(void)
{
return PyModuleDef_Init(&blake2_module);
}
}
1 change: 1 addition & 0 deletions Modules/_bz2module.c
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,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},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_codecsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,7 @@ static PyMethodDef _codecs_functions[] = {
};

static PyModuleDef_Slot _codecs_slots[] = {
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_collectionsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2571,6 +2571,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},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_contextvarsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,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},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_cryptmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ static PyMethodDef crypt_methods[] = {
};

static PyModuleDef_Slot _crypt_slots[] = {
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_csv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1798,6 +1798,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},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_ctypes/_ctypes_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,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},
{0, NULL}
};

Expand Down
2 changes: 2 additions & 0 deletions Modules/_curses_panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,8 @@ _curses_panel_exec(PyObject *mod)

static PyModuleDef_Slot _curses_slots[] = {
{Py_mod_exec, _curses_panel_exec},
// XXX gh-103092: fix isolation.
//{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_dbmmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,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},
{0, NULL}
};

Expand Down
2 changes: 2 additions & 0 deletions Modules/_elementtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -4419,6 +4419,8 @@ module_exec(PyObject *m)

static struct PyModuleDef_Slot elementtree_slots[] = {
{Py_mod_exec, module_exec},
// XXX gh-103092: fix isolation.
//{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
{0, NULL},
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_functoolsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,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},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_gdbmmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,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},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_hashopenssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2260,6 +2260,7 @@ static PyModuleDef_Slot hashlib_slots[] = {
{Py_mod_exec, hashlib_md_meth_names},
{Py_mod_exec, hashlib_init_constructors},
{Py_mod_exec, hashlib_exception},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_heapqmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,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},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -1801,6 +1801,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},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_localemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,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},
{0, NULL}
};

Expand Down
2 changes: 2 additions & 0 deletions Modules/_lsprof.c
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,8 @@ _lsprof_exec(PyObject *module)

static PyModuleDef_Slot _lsprofslots[] = {
{Py_mod_exec, _lsprof_exec},
// XXX gh-103092: fix isolation.
//{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_lzmamodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1611,6 +1611,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},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_multiprocessing/multiprocessing.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,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},
{0, NULL}
};

Expand Down
7 changes: 7 additions & 0 deletions Modules/_multiprocessing/posixshmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,19 @@ static PyMethodDef module_methods[ ] = {
};


static PyModuleDef_Slot module_slots[] = {
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
{0, NULL}
};


static struct PyModuleDef _posixshmemmodule = {
PyModuleDef_HEAD_INIT,
.m_name = "_posixshmem",
.m_doc = "POSIX shared memory module",
.m_size = 0,
.m_methods = module_methods,
.m_slots = module_slots,
};

/* Module init function */
Expand Down
8 changes: 7 additions & 1 deletion Modules/_opcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,18 @@ opcode_functions[] = {
{NULL, NULL, 0, NULL}
};

static PyModuleDef_Slot module_slots[] = {
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
{0, NULL}
};

static struct PyModuleDef opcodemodule = {
PyModuleDef_HEAD_INIT,
.m_name = "_opcode",
.m_doc = "Opcode support module.",
.m_size = 0,
.m_methods = opcode_functions
.m_methods = opcode_functions,
.m_slots = module_slots,
};

PyMODINIT_FUNC
Expand Down
1 change: 1 addition & 0 deletions Modules/_operator.c
Original file line number Diff line number Diff line change
Expand Up @@ -1828,6 +1828,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},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_pickle.c
Original file line number Diff line number Diff line change
Expand Up @@ -7912,6 +7912,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},
{0, NULL},
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_posixsubprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,7 @@ static PyMethodDef module_methods[] = {
};

static PyModuleDef_Slot _posixsubprocess_slots[] = {
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_queuemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,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},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_randommodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,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},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_scproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ static PyMethodDef mod_methods[] = {
};

static PyModuleDef_Slot _scproxy_slots[] = {
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_sha3/sha3module.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,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},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_sqlite/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,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},
{0, NULL},
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_sre/sre.c
Original file line number Diff line number Diff line change
Expand Up @@ -3221,6 +3221,7 @@ sre_exec(PyObject *m)

static PyModuleDef_Slot sre_slots[] = {
{Py_mod_exec, sre_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
{0, NULL},
};

Expand Down
2 changes: 2 additions & 0 deletions Modules/_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -6161,6 +6161,8 @@ static PyModuleDef_Slot sslmodule_slots[] = {
{Py_mod_exec, sslmodule_init_constants},
{Py_mod_exec, sslmodule_init_versioninfo},
{Py_mod_exec, sslmodule_init_strings},
// XXX gh-103092: fix isolation.
//{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,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},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_statisticsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ PyDoc_STRVAR(statistics_doc,
"Accelerators for the statistics module.\n");

static struct PyModuleDef_Slot _statisticsmodule_slots[] = {
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_struct.c
Original file line number Diff line number Diff line change
Expand Up @@ -2572,6 +2572,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},
{0, NULL}
};

Expand Down
1 change: 1 addition & 0 deletions Modules/_testinternalcapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,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},
{0, NULL},
};

Expand Down
Loading