]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Can't return NULL from a void function. If there is a memory error,
authorNeal Norwitz <nnorwitz@gmail.com>
Mon, 14 Aug 2006 00:59:03 +0000 (00:59 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Mon, 14 Aug 2006 00:59:03 +0000 (00:59 +0000)
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 0e4356b4c8a7ebcd65f3bcc984a4bd348ff70c36..b79f06e9cbeac5311d56bda06b1a02174111791a 100644 (file)
@@ -624,9 +624,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);