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: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=32fd6eab1e9e3304b504943b425c7d9ba65bba66;p=thirdparty%2FPython%2Fcpython.git Issue #18408: Fix list.extend(), handle list_resize() failure --- diff --git a/Objects/listobject.c b/Objects/listobject.c index b18ef5763afe..0ec70e587af8 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;