[Python-checkins] r52260 - python/branches/release24-maint/Objects/classobject.c

tim.peters python-checkins at python.org
Tue Oct 10 01:37:59 CEST 2006


Author: tim.peters
Date: Tue Oct 10 01:37:58 2006
New Revision: 52260

Modified:
   python/branches/release24-maint/Objects/classobject.c
Log:
Backport rev 51262 from trunk -- squashes a compiler warning on Windows
about truly wrong code.

Checkin comment from 51262:

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/branches/release24-maint/Objects/classobject.c
==============================================================================
--- python/branches/release24-maint/Objects/classobject.c	(original)
+++ python/branches/release24-maint/Objects/classobject.c	Tue Oct 10 01:37:58 2006
@@ -656,9 +656,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