mirror of
https://github.com/python/cpython.git
synced 2025-11-02 19:12:55 +00:00
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.
This commit is contained in:
parent
714a59d265
commit
af33f2d571
1 changed files with 2 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue