diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-07-16 19:45:58 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-07-16 19:45:58 (GMT) |
commit | 32fd6eab1e9e3304b504943b425c7d9ba65bba66 (patch) | |
tree | ea4e27aad769e06a6c71fec27e55f956f3f031cf /Objects/listobject.c | |
parent | d1f9942ae399c765c1bee392658fc0f56f963ec5 (diff) | |
download | cpython-32fd6eab1e9e3304b504943b425c7d9ba65bba66.zip cpython-32fd6eab1e9e3304b504943b425c7d9ba65bba66.tar.gz cpython-32fd6eab1e9e3304b504943b425c7d9ba65bba66.tar.bz2 |
Issue #18408: Fix list.extend(), handle list_resize() failure
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r-- | Objects/listobject.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index b18ef57..0ec70e5 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; |