bpo-40513: new_interpreter() init GIL earlier (GH-19942)

Fix also code to handle init_interp_main() failure.
This commit is contained in:
Victor Stinner 2020-05-05 20:16:37 +02:00 committed by GitHub
parent e838a9324c
commit 0dd5e7a718
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -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();