File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2411,18 +2411,17 @@ new_interpreter(PyThreadState **tstate_p,
24112411 interpreters: disable PyGILState_Check(). */
24122412 runtime -> gilstate .check_enabled = 0 ;
24132413
2414- PyInterpreterState * interp = PyInterpreterState_New ();
2414+ // XXX Might new_interpreter() have been called without the GIL held?
2415+ PyThreadState * save_tstate = _PyThreadState_GET ();
2416+ PyThreadState * tstate = NULL ;
2417+ PyInterpreterState * interp ;
2418+ status = _PyInterpreterState_New (save_tstate , & interp );
24152419 if (interp == NULL ) {
2416- * tstate_p = NULL ;
2417- return _PyStatus_OK ();
2420+ goto error ;
24182421 }
24192422 _PyInterpreterState_SetWhence (interp , whence );
24202423 interp -> _ready = 1 ;
24212424
2422- // XXX Might new_interpreter() have been called without the GIL held?
2423- PyThreadState * save_tstate = _PyThreadState_GET ();
2424- PyThreadState * tstate = NULL ;
2425-
24262425 /* From this point until the init_interp_create_gil() call,
24272426 we must not do anything that requires that the GIL be held
24282427 (or otherwise exist). That applies whether or not the new
@@ -2498,7 +2497,7 @@ new_interpreter(PyThreadState **tstate_p,
24982497 * tstate_p = NULL ;
24992498 if (tstate != NULL ) {
25002499 Py_EndInterpreter (tstate );
2501- } else {
2500+ } else if ( interp != NULL ) {
25022501 PyInterpreterState_Delete (interp );
25032502 }
25042503 if (save_tstate != NULL ) {
You can’t perform that action at this time.
0 commit comments