summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-08-22 23:15:42 (GMT)
committerGuido van Rossum <guido@python.org>1996-08-22 23:15:42 (GMT)
commitad8997887b5300caef0f347a07f39b3ff94b034a (patch)
treea8304580679cb146f10e85b04ac1bf8bec2b2e89
parent2a516c8f2c3fd66919007b8bf1be1134b44b9a5a (diff)
downloadcpython-ad8997887b5300caef0f347a07f39b3ff94b034a.zip
cpython-ad8997887b5300caef0f347a07f39b3ff94b034a.tar.gz
cpython-ad8997887b5300caef0f347a07f39b3ff94b034a.tar.bz2
Be a bit more careful with printing a warning for a failed __del__.
-rw-r--r--Objects/classobject.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c
index 5776898..191b556 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -404,8 +404,11 @@ instance_dealloc(inst)
object *res = call_object(del, (object *)NULL);
DECREF(del);
if (res == NULL) {
- writestring("exception in __del__ method ignored\n",
- sysget("stderr"));
+ PyObject *f = sysget("stderr");
+ err_clear();
+ if (f != NULL)
+ writestring(
+ "exception in __del__ method ignored\n", f);
}
else
DECREF(res);