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

This commit is contained in:
Victor Stinner 2013-07-16 21:45:58 +02:00
parent d1f9942ae3
commit 32fd6eab1e

View file

@ -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;