diff options
author | Victor Stinner <vstinner@python.org> | 2020-06-23 15:55:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-23 15:55:45 +0200 |
commit | 30a89338eb377df08ea8724809101d14612a32eb (patch) | |
tree | bdb63e2205723b49353cfdfbcd7018228e813b12 | |
parent | bpo-36710: Pass tstate explicitly in abstract.c (GH-21075) (diff) | |
download | cpython-30a89338eb377df08ea8724809101d14612a32eb.tar.gz cpython-30a89338eb377df08ea8724809101d14612a32eb.tar.bz2 cpython-30a89338eb377df08ea8724809101d14612a32eb.zip |
Call _PyWarnings_InitState() in subinterpreters (GH-21078)
Py_InitializeFromConfig() now calls also _PyWarnings_InitState() in
subinterpreters.
-rw-r--r-- | Python/pylifecycle.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 4bb32abc4be..f0770727f4d 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -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; - } + /* Initialize _warnings. */ + status = _PyWarnings_InitState(tstate); + if (_PyStatus_EXCEPTION(status)) { + return status; + } - if (config->_install_importlib) { + 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) { + /* This call sets up builtin and frozen import support */ status = init_importlib(tstate, sysmod); if (_PyStatus_EXCEPTION(status)) { return status; |