Be a bit more careful with printing a warning for a failed __del__.

This commit is contained in:
Guido van Rossum 1996-08-22 23:15:42 +00:00
parent 2a516c8f2c
commit ad8997887b

View file

@ -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);