summaryrefslogtreecommitdiffstats
path: root/Python/errors.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-10-24 15:11:22 (GMT)
committerGeorg Brandl <georg@python.org>2010-10-24 15:11:22 (GMT)
commit08be72d0aa0112118b79d271479598c218adfd23 (patch)
tree5c885e7f573248c725915ed00f4a0476daa7a556 /Python/errors.c
parent872a702bbd3c471278e07d773f7a5a49eb9dc5b2 (diff)
downloadcpython-08be72d0aa0112118b79d271479598c218adfd23.zip
cpython-08be72d0aa0112118b79d271479598c218adfd23.tar.gz
cpython-08be72d0aa0112118b79d271479598c218adfd23.tar.bz2
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.
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/errors.c b/Python/errors.c
index e3486b9..0490614 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -767,8 +767,10 @@ PyErr_WriteUnraisable(PyObject *obj)
}
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 */
}