diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-14 00:59:03 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-14 00:59:03 (GMT) |
commit | af33f2d57191985a9bf13b40549b6294873de68b (patch) | |
tree | fe32e01b48aa43b3165cc75a7cdbf9d1d934de08 /Objects | |
parent | 714a59d26516a324f808cc1d27b19642188e33e5 (diff) | |
download | cpython-af33f2d57191985a9bf13b40549b6294873de68b.zip cpython-af33f2d57191985a9bf13b40549b6294873de68b.tar.gz cpython-af33f2d57191985a9bf13b40549b6294873de68b.tar.bz2 |
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.
Diffstat (limited to 'Objects')
-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); |