diff Python/_warnings.c @ 61757:deed5fce82d6

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 Wed, 19 May 2010 20:40:50 +0000
parents cab14be0ada1
children 907f564476be
line wrap: on
line diff
--- a/Python/_warnings.c	Wed May 19 17:15:50 2010 +0000
+++ b/Python/_warnings.c	Wed May 19 20:40:50 2010 +0000
@@ -116,7 +116,7 @@
         _filters = warnings_filters;
     }
 
-    if (!PyList_Check(_filters)) {
+    if (_filters == NULL || !PyList_Check(_filters)) {
         PyErr_SetString(PyExc_ValueError,
                         MODULE_NAME ".filters must be a list");
         return NULL;