(original) (raw)
changeset: 84671:395e67f348e7 user: Victor Stinner victor.stinner@gmail.com date: Tue Jul 16 21:45:58 2013 +0200 files: Objects/listobject.c description: Issue #18408: Fix list.extend(), handle list_resize() failure diff -r f0efd7ea1627 -r 395e67f348e7 Objects/listobject.c --- a/Objects/listobject.c Tue Jul 16 21:41:43 2013 +0200 +++ b/Objects/listobject.c Tue Jul 16 21:45:58 2013 +0200 @@ -871,8 +871,10 @@ } /* 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; /victor.stinner@gmail.com