File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,9 @@ PyAPI_DATA(const struct _frozen *) _PyImport_FrozenStdlib;
52
52
PyAPI_DATA (const struct _frozen * ) _PyImport_FrozenTest ;
53
53
extern const struct _module_alias * _PyImport_FrozenAliases ;
54
54
55
+ PyAPI_FUNC (int ) _PyImport_CheckSubinterpIncompatibleExtensionAllowed (
56
+ const char * name );
57
+
55
58
#ifdef __cplusplus
56
59
}
57
60
#endif
Original file line number Diff line number Diff line change @@ -2395,6 +2395,21 @@ exec_builtin_or_dynamic(PyObject *mod) {
2395
2395
return PyModule_ExecDef (mod , def );
2396
2396
}
2397
2397
2398
+ int
2399
+ _PyImport_CheckSubinterpIncompatibleExtensionAllowed (const char * name )
2400
+ {
2401
+ PyInterpreterState * interp = _PyInterpreterState_Get ();
2402
+ if (_PyInterpreterState_HasFeature (
2403
+ interp , Py_RTFLAGS_MULTI_INTERP_EXTENSIONS )) {
2404
+ assert (!_Py_IsMainInterpreter (interp ));
2405
+ PyErr_Format (PyExc_ImportError ,
2406
+ "module %s does not support loading in subinterpreters" ,
2407
+ name );
2408
+ return -1 ;
2409
+ }
2410
+ return 0 ;
2411
+ }
2412
+
2398
2413
#ifdef HAVE_DYNAMIC_LOADING
2399
2414
2400
2415
/*[clinic input]
You can’t perform that action at this time.
0 commit comments