]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport rev 51262 from trunk -- squashes a compiler warning on Windows
authorTim Peters <tim.peters@gmail.com>
Mon, 9 Oct 2006 23:37:58 +0000 (23:37 +0000)
committerTim Peters <tim.peters@gmail.com>
Mon, 9 Oct 2006 23:37:58 +0000 (23:37 +0000)
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

index 7457d42b8a81ee41488fb5a6e7cde6ce088f1e0b..7eb542796c396cc57e3a77962e6525efc855fba5 100644 (file)
@@ -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);