mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
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.
This commit is contained in:
parent
b65413b497
commit
37cd982df0
3 changed files with 28 additions and 13 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue