return -1;
}
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+ // Switch to interpreter.
+ PyThreadState *new_tstate = PyInterpreterState_ThreadHead(interp);
+ PyThreadState *save1 = PyEval_SaveThread();
+
+ (void)PyThreadState_Swap(new_tstate);
+
+ // Run the script.
+ _sharedexception *exc = NULL;
+ int result = _run_script(interp, codestr, shared, &exc);
+
+ // Switch back.
+ PyEval_RestoreThread(save1);
+#else
// Switch to interpreter.
PyThreadState *save_tstate = NULL;
if (interp != PyInterpreterState_Get()) {
if (save_tstate != NULL) {
PyThreadState_Swap(save_tstate);
}
+#endif
// Propagate any exception out to the caller.
if (exc != NULL) {