diff Python/pythonrun.c @ 61776:3271af035d01 3.1

Recorded merge of revisions 81364 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r81364 | victor.stinner | 2010-05-19 22:40:50 +0200 (mer., 19 mai 2010) | 3 lines Issue #8766: Initialize _warnings module before importing the first module. Fix a crash if an empty directory called "encodings" exists in sys.path. ........
author Victor Stinner <victor.stinner@haypocalc.com>
date Thu, 20 May 2010 21:00:34 +0000
parents ca81646dd29c
children f83f201b1276
line wrap: on
line diff
--- a/Python/pythonrun.c	Thu May 20 10:41:41 2010 +0000
+++ b/Python/pythonrun.c	Thu May 20 21:00:34 2010 +0000
@@ -264,6 +264,9 @@
 
     _PyImportHooks_Init();
 
+    /* Initialize _warnings. */
+    _PyWarnings_Init();
+
 #if defined(HAVE_LANGINFO_H) && defined(CODESET)
     /* On Unix, set the file system encoding according to the
        user's preference, if the CODESET names a well-known
@@ -284,7 +287,6 @@
         initsigs(); /* Signal handling stuff, including initintr() */
 
     /* Initialize warnings. */
-    _PyWarnings_Init();
     if (PySys_HasWarnOptions()) {
         PyObject *warnings_module = PyImport_ImportModule("warnings");
         if (!warnings_module)