diff Python/errors.c @ 65624:39b9e9de372b

Add a new warning gategory, ResourceWarning, as discussed on python-dev. It is silent by default, except when configured --with-pydebug. Emit this warning from the GC shutdown procedure, rather than just printing to stderr.
author Georg Brandl <georg@python.org>
date Sun, 24 Oct 2010 15:11:22 +0000
parents 38ad57db88ac
children 1b7a0385c65f
line wrap: on
line diff
--- a/Python/errors.c	Sun Oct 24 14:32:45 2010 +0000
+++ b/Python/errors.c	Sun Oct 24 15:11:22 2010 +0000
@@ -767,8 +767,10 @@
             }
             Py_XDECREF(moduleName);
         }
-        PyFile_WriteString(" in ", f);
-        PyFile_WriteObject(obj, f, 0);
+        if (obj) {
+            PyFile_WriteString(" in ", f);
+            PyFile_WriteObject(obj, f, 0);
+        }
         PyFile_WriteString(" ignored\n", f);
         PyErr_Clear(); /* Just in case */
     }