@@ -436,13 +436,13 @@ optionally followed by an import of the module::
436436
437437.. note ::
438438
439- If you define * static * extension types rather than heap-allocated types,
440- the module can cause the same problems as the legacy single-phase
441- initialization when removing entries from ``sys.modules `` or importing
442- compiled modules into multiple interpreters within a process
443- (or following a :c:func: ` fork ` without an intervening :c:func: `exec `).
444- In this case, at least the module should reject subinterpreters by using
445- a :c:type: ` PyModuleDef_Slot ` (`` Py_mod_multiple_interpreters ` `).
439+ If you declare a global variable or a local static one, the module can
440+ cause the same problems as the legacy single-phase initialization when
441+ removing entries from ``sys.modules `` or importing compiled modules into
442+ multiple interpreters within a process (or following a :c:func: ` fork ` without an
443+ intervening :c:func: `exec `). In this case, at least the module should
444+ stop supporting subinterpreters through a :c:type: ` PyModuleDef_Slot `
445+ ( :c:data: ` Py_mod_multiple_interpreters `).
446446
447447A more substantial example module is included in the Python source distribution
448448as :file: `Modules/xxlimited.c `. This file may be used as a template or simply
@@ -1279,6 +1279,8 @@ function must take care of initializing the C API pointer array::
12791279
12801280 static PyModuleDef_Slot spam_module_slots[] = {
12811281 {Py_mod_exec, spam_module_exec},
1282+ // Just use this while using a local static variable
1283+ {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
12821284 {0, NULL}
12831285 };
12841286
0 commit comments