diff options
author | Sam Gross <colesbury@gmail.com> | 2024-04-11 15:00:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-11 15:00:54 -0400 |
commit | 25f6ff5d3e92305659db62e7f7545f823f0dbd05 (patch) | |
tree | 3fe6dd2136780028874b6b3cde3ca8c4c903f033 /Python/import.c | |
parent | 39d381f91e93559011587d764c1895ee30efb741 (diff) | |
download | cpython-25f6ff5d3e92305659db62e7f7545f823f0dbd05.tar.gz cpython-25f6ff5d3e92305659db62e7f7545f823f0dbd05.zip |
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`.
Diffstat (limited to 'Python/import.c')
-rw-r--r-- | Python/import.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c index 6544a84d895..b040c7d5c0f 100644 --- a/Python/import.c +++ b/Python/import.c @@ -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 |