mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
gh-117649: Raise ImportError for unsupported modules in free-threaded build (#117651)
The free-threaded build does not currently support the combination of single-phase init modules and non-isolated subinterpreters. Ensure that `check_multi_interp_extensions` is always `True` for subinterpreters in the free-threaded build so that importing these modules raises an `ImportError`.
This commit is contained in:
parent
39d381f91e
commit
25f6ff5d3e
9 changed files with 103 additions and 32 deletions
|
|
@ -3696,9 +3696,16 @@ _imp__override_multi_interp_extensions_check_impl(PyObject *module,
|
|||
"cannot be used in the main interpreter");
|
||||
return NULL;
|
||||
}
|
||||
#ifdef Py_GIL_DISABLED
|
||||
PyErr_SetString(PyExc_RuntimeError,
|
||||
"_imp._override_multi_interp_extensions_check() "
|
||||
"cannot be used in the free-threaded build");
|
||||
return NULL;
|
||||
#else
|
||||
int oldvalue = OVERRIDE_MULTI_INTERP_EXTENSIONS_CHECK(interp);
|
||||
OVERRIDE_MULTI_INTERP_EXTENSIONS_CHECK(interp) = override;
|
||||
return PyLong_FromLong(oldvalue);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_DYNAMIC_LOADING
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue