From: Victor Stinner Date: Tue, 16 Jul 2013 19:45:58 +0000 (+0200) Subject: Issue #18408: Fix list.extend(), handle list_resize() failure X-Git-Tag: v3.4.0a1~186 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=32fd6eab1e9e3304b504943b425c7d9ba65bba66;p=python Issue #18408: Fix list.extend(), handle list_resize() failure --- diff --git a/Objects/listobject.c b/Objects/listobject.c index b18ef5763a..0ec70e587a 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -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;