mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
gh-99113: Add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104205)
Here we are doing no more than adding the value for Py_mod_multiple_interpreters and using it for stdlib modules. We will start checking for it in gh-104206 (once PyInterpreterState.ceval.own_gil is added in gh-104204).
This commit is contained in:
parent
1c420e138f
commit
a9c6e0618f
99 changed files with 144 additions and 4 deletions
|
@ -250,6 +250,7 @@ PyModule_FromDefAndSpec2(PyModuleDef* def, PyObject *spec, int module_api_versio
|
|||
int has_execution_slots = 0;
|
||||
const char *name;
|
||||
int ret;
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
|
||||
PyModuleDef_Init(def);
|
||||
|
||||
|
@ -316,13 +317,13 @@ PyModule_FromDefAndSpec2(PyModuleDef* def, PyObject *spec, int module_api_versio
|
|||
multiple_interpreters = Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED;
|
||||
}
|
||||
if (multiple_interpreters == Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED) {
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
if (!_Py_IsMainInterpreter(interp)
|
||||
&& _PyImport_CheckSubinterpIncompatibleExtensionAllowed(name) < 0)
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
// XXX Do a similar check once we have PyInterpreterState.ceval.own_gil.
|
||||
|
||||
if (create) {
|
||||
m = create(spec, def);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue