mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Issue #8766: Initialize _warnings module before importing the first module.
Fix a crash if an empty directory called "encodings" exists in sys.path.
This commit is contained in:
parent
5b08b4d230
commit
7d79b8b771
4 changed files with 36 additions and 13 deletions
|
@ -265,13 +265,15 @@ Py_InitializeEx(int install_sigs)
|
|||
|
||||
_PyImportHooks_Init();
|
||||
|
||||
/* Initialize _warnings. */
|
||||
_PyWarnings_Init();
|
||||
|
||||
initfsencoding();
|
||||
|
||||
if (install_sigs)
|
||||
initsigs(); /* Signal handling stuff, including initintr() */
|
||||
|
||||
/* Initialize warnings. */
|
||||
_PyWarnings_Init();
|
||||
if (PySys_HasWarnOptions()) {
|
||||
PyObject *warnings_module = PyImport_ImportModule("warnings");
|
||||
if (!warnings_module)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue