]> granicus.if.org Git - python/commitdiff
Be a bit more careful with printing a warning for a failed __del__.
authorGuido van Rossum <guido@python.org>
Thu, 22 Aug 1996 23:15:42 +0000 (23:15 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 22 Aug 1996 23:15:42 +0000 (23:15 +0000)
Objects/classobject.c

index 57768988cd8b813ce14590ad59b5411f1d3920f2..191b5568c0e13c014ea5f452461424afb479d01d 100644 (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);