[Python-checkins] r51262 - python/trunk/Objects/classobject.c

neal.norwitz python-checkins at python.org
Mon Aug 14 02:59:04 CEST 2006


Author: neal.norwitz
Date: Mon Aug 14 02:59:03 2006
New Revision: 51262

Modified:
   python/trunk/Objects/classobject.c
Log:
Can't return NULL from a void function.  If there is a memory error,
about the best we can do is call PyErr_WriteUnraisable and go on.
We won't be able to do the call below either, so verify delstr is valid.


Modified: python/trunk/Objects/classobject.c
==============================================================================
--- python/trunk/Objects/classobject.c	(original)
+++ python/trunk/Objects/classobject.c	Mon Aug 14 02:59:03 2006
@@ -624,9 +624,9 @@
 	if (delstr == NULL) {
 		delstr = PyString_InternFromString("__del__");
 		if (delstr == NULL)
-			return NULL;
+			PyErr_WriteUnraisable((PyObject*)inst);
 	}
-	if ((del = instance_getattr2(inst, delstr)) != NULL) {
+	if (delstr && (del = instance_getattr2(inst, delstr)) != NULL) {
 		PyObject *res = PyEval_CallObject(del, (PyObject *)NULL);
 		if (res == NULL)
 			PyErr_WriteUnraisable(del);


More information about the Python-checkins mailing list