diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 5726a559cfc..2149d8928d5 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -1575,6 +1575,11 @@ new_interpreter(PyThreadState **tstate_p, int isolated_subinterpreter) } interp->config._isolated_interpreter = isolated_subinterpreter; + status = init_interp_create_gil(tstate); + if (_PyStatus_EXCEPTION(status)) { + goto error; + } + status = pycore_interp_init(tstate); if (_PyStatus_EXCEPTION(status)) { goto error; @@ -1585,11 +1590,6 @@ new_interpreter(PyThreadState **tstate_p, int isolated_subinterpreter) goto error; } - status = init_interp_create_gil(tstate); - if (_PyStatus_EXCEPTION(status)) { - return status; - } - *tstate_p = tstate; return _PyStatus_OK();