Commit 2705492e authored by Victor Stinner's avatar Victor Stinner

Issue #18408: Fix list.extend(), handle list_resize() failure

parent b67a4a34
...@@ -871,8 +871,10 @@ listextend(PyListObject *self, PyObject *b) ...@@ -871,8 +871,10 @@ listextend(PyListObject *self, PyObject *b)
} }
/* Cut back result list if initial guess was too large. */ /* Cut back result list if initial guess was too large. */
if (Py_SIZE(self) < self->allocated) if (Py_SIZE(self) < self->allocated) {
list_resize(self, Py_SIZE(self)); /* shrinking can't fail */ if (list_resize(self, Py_SIZE(self)) < 0)
goto error;
}
Py_DECREF(it); Py_DECREF(it);
Py_RETURN_NONE; Py_RETURN_NONE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment