diff options
author | Guido van Rossum <guido@python.org> | 1996-08-22 23:15:42 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-08-22 23:15:42 (GMT) |
commit | ad8997887b5300caef0f347a07f39b3ff94b034a (patch) | |
tree | a8304580679cb146f10e85b04ac1bf8bec2b2e89 | |
parent | 2a516c8f2c3fd66919007b8bf1be1134b44b9a5a (diff) | |
download | cpython-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.c | 7 |
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); |