@@ -259,14 +259,6 @@ with an exception object::
259259
260260 static PyModuleDef_Slot spam_module_slots[] = {
261261 {Py_mod_exec, spam_module_exec},
262- #ifdef Py_mod_multiple_interpreters
263- // signal that this module can be imported in isolated subinterpreters
264- {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
265- #endif
266- #ifdef Py_mod_gil
267- // signal that this module supports running without an active GIL
268- {Py_mod_gil, Py_MOD_GIL_NOT_USED},
269- #endif
270262 {0, NULL}
271263 };
272264
@@ -484,15 +476,15 @@ optionally followed by an import of the module::
484476.. note ::
485477
486478 If you define *static * extension types rather than heap-allocated types,
487- the module can create the same problems as the legacy single-phase
479+ the module can cause the same problems as the legacy single-phase
488480 initialization when removing entries from ``sys.modules `` or importing
489481 compiled modules into multiple interpreters within a process
490482 (or following a :c:func: `fork ` without an intervening :c:func: `exec `).
491- In this case, at least the :c:data: ` Py_mod_multiple_interpreters ` slot
492- in the examples should be `` Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED `` .
483+ In this case, at least the module should reject subinterpreters by using
484+ a :c:type: ` PyModuleDef_Slot ` (`` Py_mod_multiple_interpreters ``) .
493485
494486A more substantial example module is included in the Python source distribution
495- as :file: `Modules/xxlimited.c `. This file may be used as a template or simply
487+ as :file: `Modules/xxlimited.c `. This file may be used as a template or simply
496488read as an example.
497489
498490.. _compilation :
@@ -834,22 +826,11 @@ Philbrick (philbrick@hks.com)::
834826 {NULL, NULL, 0, NULL} /* sentinel */
835827 };
836828
837- static PyModuleDef_Slot keywdarg_slots[] = {
838- #ifdef Py_mod_multiple_interpreters
839- {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
840- #endif
841- #ifdef Py_mod_gil
842- {Py_mod_gil, Py_MOD_GIL_NOT_USED},
843- #endif
844- {0, NULL}
845- };
846-
847829 static struct PyModuleDef keywdarg_module = {
848830 .m_base = PyModuleDef_HEAD_INIT,
849831 .m_name = "keywdarg",
850832 .m_size = 0,
851833 .m_methods = keywdarg_methods,
852- .m_slots = keywdarg_slots,
853834 };
854835
855836 PyMODINIT_FUNC
@@ -1343,12 +1324,6 @@ function must take care of initializing the C API pointer array::
13431324
13441325 static PyModuleDef_Slot spam_module_slots[] = {
13451326 {Py_mod_exec, spam_module_exec},
1346- #ifdef Py_mod_multiple_interpreters
1347- {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
1348- #endif
1349- #ifdef Py_mod_gil
1350- {Py_mod_gil, Py_MOD_GIL_NOT_USED},
1351- #endif
13521327 {0, NULL}
13531328 };
13541329
@@ -1426,12 +1401,6 @@ like this::
14261401
14271402 static PyModuleDef_Slot client_module_slots[] = {
14281403 {Py_mod_exec, client_module_exec},
1429- #ifdef Py_mod_multiple_interpreters
1430- {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
1431- #endif
1432- #ifdef Py_mod_gil
1433- {Py_mod_gil, Py_MOD_GIL_NOT_USED},
1434- #endif
14351404 {0, NULL}
14361405 };
14371406
0 commit comments