diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2023-05-06 21:57:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-06 21:57:35 (GMT) |
commit | fff193bbfebe7b00229856b1e8105ab3de36437f (patch) | |
tree | 1deea51990bee00db4ddc40b868cbd7bcf098c64 /Objects/moduleobject.c | |
parent | 3b14b51d11ae23a915299a8f9bf650ca2ae90566 (diff) | |
download | cpython-fff193bbfebe7b00229856b1e8105ab3de36437f.zip cpython-fff193bbfebe7b00229856b1e8105ab3de36437f.tar.gz cpython-fff193bbfebe7b00229856b1e8105ab3de36437f.tar.bz2 |
gh-99113: Add a check for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104206)
Py_MOD_PER_INTERPRETER_GIL_SUPPORTED is a new supported value for Py_mod_multiple_interpreters, added in gh-104205.
Diffstat (limited to 'Objects/moduleobject.c')
-rw-r--r-- | Objects/moduleobject.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index c100d01..985be58 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -323,7 +323,13 @@ PyModule_FromDefAndSpec2(PyModuleDef* def, PyObject *spec, int module_api_versio goto error; } } - // XXX Do a similar check once we have PyInterpreterState.ceval.own_gil. + else if (multiple_interpreters != Py_MOD_PER_INTERPRETER_GIL_SUPPORTED + && interp->ceval.own_gil + && !_Py_IsMainInterpreter(interp) + && _PyImport_CheckSubinterpIncompatibleExtensionAllowed(name) < 0) + { + goto error; + } if (create) { m = create(spec, def); |