Issue #18408: Fix list.extend(), handle list_resize() failure
This commit is contained in:
parent
d1f9942ae3
commit
32fd6eab1e
|
@ -871,8 +871,10 @@ listextend(PyListObject *self, PyObject *b)
|
|||
}
|
||||
|
||||
/* Cut back result list if initial guess was too large. */
|
||||
if (Py_SIZE(self) < self->allocated)
|
||||
list_resize(self, Py_SIZE(self)); /* shrinking can't fail */
|
||||
if (Py_SIZE(self) < self->allocated) {
|
||||
if (list_resize(self, Py_SIZE(self)) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
Py_DECREF(it);
|
||||
Py_RETURN_NONE;
|
||||
|
|
Loading…
Reference in New Issue