Skip to content

Commit 9c24b34

Browse files
Add PyInterpreterState.override_multi_interp_extensions_check.
1 parent 72ab9b6 commit 9c24b34

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Include/internal/pycore_interp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ struct _is {
123123
// override for config->use_frozen_modules (for tests)
124124
// (-1: "off", 1: "on", 0: no override)
125125
int override_frozen_modules;
126+
int override_multi_interp_extensions_check;
126127

127128
PyObject *codec_search_path;
128129
PyObject *codec_search_cache;

Python/import.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2400,7 +2400,9 @@ _PyImport_CheckSubinterpIncompatibleExtensionAllowed(const char *name)
24002400
{
24012401
PyInterpreterState *interp = _PyInterpreterState_Get();
24022402
if (_PyInterpreterState_HasFeature(
2403-
interp, Py_RTFLAGS_MULTI_INTERP_EXTENSIONS)) {
2403+
interp, Py_RTFLAGS_MULTI_INTERP_EXTENSIONS) &&
2404+
!interp->override_multi_interp_extensions_check
2405+
) {
24042406
assert(!_Py_IsMainInterpreter(interp));
24052407
PyErr_Format(PyExc_ImportError,
24062408
"module %s does not support loading in subinterpreters",

0 commit comments

Comments
 (0)