]> granicus.if.org Git - python/commitdiff
Fix a bug in PySys_HasWarnOption() where it was not properly checking the
authorBrett Cannon <bcannon@gmail.com>
Sun, 13 Apr 2008 00:18:44 +0000 (00:18 +0000)
committerBrett Cannon <bcannon@gmail.com>
Sun, 13 Apr 2008 00:18:44 +0000 (00:18 +0000)
length of the list storing the warning options.

Python/sysmodule.c

index d6ccd17b5a4b7f69e9bd5ddbfb2dc87b8c5855c4..5293c974035333b5b041356a40aaa485819aa6cf 100644 (file)
@@ -943,7 +943,7 @@ PySys_AddWarnOption(char *s)
 int
 PySys_HasWarnOptions(void)
 {
-    return warnoptions ? 1 : 0;
+    return (warnoptions != NULL && (PyList_Size(warnoptions) > 0)) ? 1 : 0;
 }
 
 /* XXX This doc string is too long to be a single string literal in VC++ 5.0.