diff options
author | Victor Stinner <vstinner@redhat.com> | 2018-11-16 11:55:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-16 11:55:35 +0100 |
commit | 37cd982df02795905886ab36a2378ed557cb6f60 (patch) | |
tree | aa750eca7acb660a0d3156fd7820396c2dff2f4c /Python/pylifecycle.c | |
parent | b65413b497a07f521d835b799be7dd0afcedbd65 (diff) | |
download | cpython-git-37cd982df02795905886ab36a2378ed557cb6f60.tar.gz |
bpo-35239: _PySys_EndInit() copies module_search_path (GH-10532)
* The _PySys_EndInit() function now copies the
config->module_search_path list, so config is longer modified when
sys.path is updated.
* config->warnoptions list and config->xoptions dict are also copied
* test_embed: InitConfigTests now also tests
main_config['module_search_path']
* Fix _Py_InitializeMainInterpreter(): don't use config->warnoptions
but sys.warnoptions to decide if the warnings module should
be imported at startup.
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r-- | Python/pylifecycle.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 4ccea2ece2..58e1647310 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -836,8 +836,8 @@ _Py_InitializeMainInterpreter(PyInterpreterState *interp, } /* Initialize warnings. */ - if (interp->config.warnoptions != NULL && - PyList_Size(interp->config.warnoptions) > 0) + PyObject *warnoptions = PySys_GetObject("warnoptions"); + if (warnoptions != NULL && PyList_Size(warnoptions) > 0) { PyObject *warnings_module = PyImport_ImportModule("warnings"); if (warnings_module == NULL) { |