From: Tim Peters Date: Mon, 9 Oct 2006 23:37:58 +0000 (+0000) Subject: Backport rev 51262 from trunk -- squashes a compiler warning on Windows X-Git-Tag: v2.4.4c1~8 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=0af9b87953a450145a1557fc93fa4a82463263b1;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Objects/classobject.c b/Objects/classobject.c index 7457d42b8a81..7eb542796c39 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -656,9 +656,9 @@ instance_dealloc(register PyInstanceObject *inst) 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);