diff Objects/classobject.c @ 4114:5d52395f40b0 legacy-trunk

Be a bit more careful with printing a warning for a failed __del__.
author Guido van Rossum <guido@python.org>
date Thu, 22 Aug 1996 23:15:42 +0000
parents 831b420e411e
children 44872f255f93
line wrap: on
line diff
--- a/Objects/classobject.c	Thu Aug 22 23:15:05 1996 +0000
+++ b/Objects/classobject.c	Thu Aug 22 23:15:42 1996 +0000
@@ -404,8 +404,11 @@
 		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);