summaryrefslogtreecommitdiffstats
path: root/Modules/_testmultiphase.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_testmultiphase.c')
-rw-r--r--Modules/_testmultiphase.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/Modules/_testmultiphase.c b/Modules/_testmultiphase.c
index 21c5f69..ca3d832 100644
--- a/Modules/_testmultiphase.c
+++ b/Modules/_testmultiphase.c
@@ -431,6 +431,7 @@ static int execfunc(PyObject *m)
static PyModuleDef_Slot main_slots[] = {
{Py_mod_exec, execfunc},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
@@ -519,13 +520,18 @@ PyInit__testmultiphase_nonmodule_with_methods(void)
/**** Non-ASCII-named modules ****/
+static PyModuleDef_Slot nonascii_slots[] = {
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
+ {0, NULL},
+};
+
static PyModuleDef def_nonascii_latin = { \
PyModuleDef_HEAD_INIT, /* m_base */
"_testmultiphase_nonascii_latin", /* m_name */
PyDoc_STR("Module named in Czech"), /* m_doc */
0, /* m_size */
NULL, /* m_methods */
- NULL, /* m_slots */
+ nonascii_slots, /* m_slots */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
@@ -543,7 +549,7 @@ static PyModuleDef def_nonascii_kana = { \
PyDoc_STR("Module named in Japanese"), /* m_doc */
0, /* m_size */
NULL, /* m_methods */
- NULL, /* m_slots */
+ nonascii_slots, /* m_slots */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
@@ -757,6 +763,7 @@ static PyModuleDef_Slot slots_nonmodule_with_exec_slots[] = {
{Py_mod_create, createfunc_nonmodule},
{Py_mod_exec, execfunc},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
@@ -778,6 +785,7 @@ execfunc_err(PyObject *mod)
static PyModuleDef_Slot slots_exec_err[] = {
{Py_mod_exec, execfunc_err},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
@@ -800,6 +808,7 @@ execfunc_raise(PyObject *spec)
static PyModuleDef_Slot slots_exec_raise[] = {
{Py_mod_exec, execfunc_raise},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
@@ -822,6 +831,7 @@ execfunc_unreported_exception(PyObject *mod)
static PyModuleDef_Slot slots_exec_unreported_exception[] = {
{Py_mod_exec, execfunc_unreported_exception},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
@@ -857,6 +867,7 @@ meth_state_access_exec(PyObject *m)
static PyModuleDef_Slot meth_state_access_slots[] = {
{Py_mod_exec, meth_state_access_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL}
};
@@ -889,6 +900,9 @@ PyInit__test_module_state_shared(void)
if (module == NULL) {
return NULL;
}
+#ifdef Py_GIL_DISABLED
+ PyModule_ExperimentalSetGIL(module, Py_MOD_GIL_NOT_USED);
+#endif
if (PyModule_AddObjectRef(module, "Error", PyExc_Exception) < 0) {
Py_DECREF(module);
@@ -903,6 +917,7 @@ PyInit__test_module_state_shared(void)
static PyModuleDef_Slot slots_multiple_multiple_interpreters_slots[] = {
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
@@ -920,6 +935,7 @@ PyInit__testmultiphase_multiple_multiple_interpreters_slots(void)
static PyModuleDef_Slot non_isolated_slots[] = {
{Py_mod_exec, execfunc},
{Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
@@ -940,6 +956,7 @@ static PyModuleDef_Slot shared_gil_only_slots[] = {
We put it here explicitly to draw attention to the contrast
with Py_MOD_PER_INTERPRETER_GIL_SUPPORTED. */
{Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};