File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -2395,14 +2395,28 @@ exec_builtin_or_dynamic(PyObject *mod) {
2395
2395
return PyModule_ExecDef (mod , def );
2396
2396
}
2397
2397
2398
+ static bool
2399
+ check_multi_interp_extensions (PyInterpreterState * interp )
2400
+ {
2401
+ int override = interp -> override_multi_interp_extensions_check ;
2402
+ if (override < 0 ) {
2403
+ return false;
2404
+ }
2405
+ else if (override > 0 ) {
2406
+ return true;
2407
+ }
2408
+ else if (_PyInterpreterState_HasFeature (
2409
+ interp , Py_RTFLAGS_MULTI_INTERP_EXTENSIONS )) {
2410
+ return true;
2411
+ }
2412
+ return false;
2413
+ }
2414
+
2398
2415
int
2399
2416
_PyImport_CheckSubinterpIncompatibleExtensionAllowed (const char * name )
2400
2417
{
2401
2418
PyInterpreterState * interp = _PyInterpreterState_Get ();
2402
- if (_PyInterpreterState_HasFeature (
2403
- interp , Py_RTFLAGS_MULTI_INTERP_EXTENSIONS ) &&
2404
- !interp -> override_multi_interp_extensions_check
2405
- ) {
2419
+ if (check_multi_interp_extensions (interp )) {
2406
2420
assert (!_Py_IsMainInterpreter (interp ));
2407
2421
PyErr_Format (PyExc_ImportError ,
2408
2422
"module %s does not support loading in subinterpreters" ,
You can’t perform that action at this time.
0 commit comments