From 0af9b87953a450145a1557fc93fa4a82463263b1 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Mon, 9 Oct 2006 23:37:58 +0000 Subject: [PATCH] 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. --- Objects/classobject.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); -- 2.47.3