summaryrefslogtreecommitdiff
path: root/Python/errors.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-10-24 15:11:22 +0000
committerGeorg Brandl <georg@python.org>2010-10-24 15:11:22 +0000
commita799acdd559c24056cc846fa65af9b1a250e2f36 (patch)
tree8963b48347c1e0d3dc66b1ac2aab26083223d36c /Python/errors.c
parent2141d300dcbe568596fa852eb7550a1b374c7a46 (diff)
downloadcpython-a799acdd559c24056cc846fa65af9b1a250e2f36.tar.gz
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 e3486b95c5..04906141d5 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 */
}