8000 gh-104108: Add the Py_mod_multiple_interpreters Module Def Slot by ericsnowcurrently · Pull Request #104148 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-104108: Add the Py_mod_multiple_interpreters Module Def Slot #104148

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

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add constants for the Py_mod_multiple_interpreters value.
  • Loading branch information
ericsnowcurrently committed May 3, 2023
commit d708985414e8cadf49cdd58c7fb47e76f16610a8
4 changes: 4 additions & 0 deletions Include/moduleobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ struct PyModuleDef_Slot {
#define _Py_mod_LAST_SLOT 3
#endif

/* for Py_mod_multiple_interpreters: */
#define Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED 0
#define Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED 1

#endif /* New in 3.5 */

struct PyModuleDef {
Expand Down
2 changes: 1 addition & 1 deletion Objects/moduleobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ PyModule_FromDefAndSpec2(PyModuleDef* def, PyObject *spec, int module_api_versio
/* By default, multi-phase init modules are expected
to work under multiple interpreters. */
if (multiple_interpreters < 0) {
multiple_interpreters = 1;
multiple_interpreters = Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED;
}
if (!multiple_interpreters) {
PyInterpreterState *interp = _PyInterpreterState_GET();
Expand Down
0