Call _PyWarnings_InitState() in subinterpreters (GH-21078)

Py_InitializeFromConfig() now calls also _PyWarnings_InitState() in
subinterpreters.
This commit is contained in:
Victor Stinner 2020-06-23 15:55:45 +02:00 committed by GitHub
parent 61b6492961
commit 30a89338eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 11 deletions

View File

@ -685,24 +685,22 @@ pycore_init_import_warnings(PyThreadState *tstate, PyObject *sysmod)
return status;
}
const PyConfig *config = _PyInterpreterState_GetConfig(tstate->interp);
if (_Py_IsMainInterpreter(tstate)) {
/* Initialize _warnings. */
status = _PyWarnings_InitState(tstate);
if (_PyStatus_EXCEPTION(status)) {
return status;
}
const PyConfig *config = _PyInterpreterState_GetConfig(tstate->interp);
if (config->_install_importlib) {
if (_Py_IsMainInterpreter(tstate)) {
status = _PyConfig_WritePathConfig(config);
if (_PyStatus_EXCEPTION(status)) {
return status;
}
}
}
/* This call sets up builtin and frozen import support */
if (config->_install_importlib) {
status = init_importlib(tstate, sysmod);
if (_PyStatus_EXCEPTION(status)) {
return status;