diff options
-rw-r--r-- | Objects/classobject.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c index 0e4356b..b79f06e 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -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); |