summaryrefslogtreecommitdiff
path: root/Python/_warnings.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-05-19 20:40:50 +0000
committerVictor Stinner <victor.stinner@haypocalc.com>2010-05-19 20:40:50 +0000
commitc0e3f0787e625295074aee19d585f02b9b5a209a (patch)
tree32a8b01e731b53a6e7c4cd53e46da85d7b931b84 /Python/_warnings.c
parente7bd4987be3029773f7b4317c495e821a1a212fc (diff)
downloadcpython-c0e3f0787e625295074aee19d585f02b9b5a209a.tar.gz
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/_warnings.c')
-rw-r--r--Python/_warnings.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c
index c49f3f3223..b1b2b71b8d 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -116,7 +116,7 @@ get_filter(PyObject *category, PyObject *text, Py_ssize_t lineno,
_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;