From: Guido van Rossum Date: Thu, 22 Aug 1996 23:15:42 +0000 (+0000) Subject: Be a bit more careful with printing a warning for a failed __del__. X-Git-Tag: v1.4b3~43 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ad8997887b5300caef0f347a07f39b3ff94b034a;p=python Be a bit more careful with printing a warning for a failed __del__. --- diff --git a/Objects/classobject.c b/Objects/classobject.c index 57768988cd..191b5568c0 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);