bpo-38858: new_interpreter() uses pycore_init_import_warnings() (GH-17353)

This commit is contained in:
Victor Stinner 2019-11-22 21:54:33 +01:00 committed by GitHub
parent 2582d46fbc
commit 2ec1a1b307
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 14 deletions

View File

@ -665,6 +665,7 @@ pycore_init_import_warnings(PyThreadState *tstate, PyObject *sysmod)
return status;
}
if (_Py_IsMainInterpreter(tstate)) {
/* Initialize _warnings. */
if (_PyWarnings_Init() == NULL) {
return _PyStatus_ERR("can't initialize warnings");
@ -676,6 +677,7 @@ pycore_init_import_warnings(PyThreadState *tstate, PyObject *sysmod)
return status;
}
}
}
/* This call sets up builtin and frozen import support */
if (config->_install_importlib) {
@ -1575,12 +1577,7 @@ new_interpreter(PyThreadState **tstate_p)
goto done;
}
status = _PyImportHooks_Init(tstate);
if (_PyStatus_EXCEPTION(status)) {
goto done;
}
status = init_importlib(tstate, sysmod);
status = pycore_init_import_warnings(tstate, sysmod);
if (_PyStatus_EXCEPTION(status)) {
goto done;
}