summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-05-19 20:40:50 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-05-19 20:40:50 (GMT)
commit7d79b8b7714b5e7d8a0582a07b5625c280c879c0 (patch)
treebeb8d4f6b49623a468815c33febd040fa5301b11 /Python/pythonrun.c
parent5b08b4d230d95fe6a0b24dc45463e785a27fecd2 (diff)
downloadcpython-7d79b8b7714b5e7d8a0582a07b5625c280c879c0.zip
cpython-7d79b8b7714b5e7d8a0582a07b5625c280c879c0.tar.gz
cpython-7d79b8b7714b5e7d8a0582a07b5625c280c879c0.tar.bz2
Issue #8766: Initialize _warnings module before importing the first module.
Fix a crash if an empty directory called "encodings" exists in sys.path.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 58388c2..b469c4a 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -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)