File tree 2 files changed +18
-0
lines changed 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ PyAPI_DATA(const struct _frozen *) _PyImport_FrozenStdlib;
20
20
PyAPI_DATA (const struct _frozen * ) _PyImport_FrozenTest ;
21
21
extern const struct _module_alias * _PyImport_FrozenAliases ;
22
22
23
+ PyAPI_FUNC (int ) _PyImport_CheckSubinterpIncompatibleExtensionAllowed (
24
+ const char * name );
25
+
23
26
#ifdef __cplusplus
24
27
}
25
28
#endif
Original file line number Diff line number Diff line change @@ -2330,6 +2330,21 @@ exec_builtin_or_dynamic(PyObject *mod) {
2330
2330
return PyModule_ExecDef (mod , def );
2331
2331
}
2332
2332
2333
+ int
2334
+ _PyImport_CheckSubinterpIncompatibleExtensionAllowed (const char * name )
2335
+ {
2336
+ PyInterpreterState * interp = _PyInterpreterState_Get ();
2337
+ if (_PyInterpreterState_HasFeature (
2338
+ interp , Py_RTFLAGS_MULTI_INTERP_EXTENSIONS )) {
2339
+ assert (!_Py_IsMainInterpreter (interp ));
2340
+ PyErr_Format (PyExc_ImportError ,
2341
+ "module %s does not support loading in subinterpreters" ,
2342
+ name );
2343
+ return -1 ;
2344
+ }
2345
+ return 0 ;
2346
+ }
2347
+
2333
2348
#ifdef HAVE_DYNAMIC_LOADING
2334
2349
2335
2350
/*[clinic input]
You can’t perform that action at this time.
0 commit comments