Skip to content

Commit

Permalink
bpo-40513: new_interpreter() init GIL earlier (GH-19942)
Browse files Browse the repository at this point in the history
Fix also code to handle init_interp_main() failure.
  • Loading branch information
vstinner authored May 5, 2020
1 parent e838a93 commit 0dd5e7a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Python/pylifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1575,19 +1575,19 @@ new_interpreter(PyThreadState **tstate_p, int isolated_subinterpreter)
}
interp->config._isolated_interpreter = isolated_subinterpreter;

status = pycore_interp_init(tstate);
status = init_interp_create_gil(tstate);
if (_PyStatus_EXCEPTION(status)) {
goto error;
}

status = init_interp_main(tstate);
status = pycore_interp_init(tstate);
if (_PyStatus_EXCEPTION(status)) {
goto error;
}

status = init_interp_create_gil(tstate);
status = init_interp_main(tstate);
if (_PyStatus_EXCEPTION(status)) {
return status;
goto error;
}

*tstate_p = tstate;
Expand Down

0 comments on commit 0dd5e7a

Please sign in to comment.