summaryrefslogtreecommitdiffstats
path: root/Objects/listobject.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-16 19:45:58 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-07-16 19:45:58 (GMT)
commit32fd6eab1e9e3304b504943b425c7d9ba65bba66 (patch)
treeea4e27aad769e06a6c71fec27e55f956f3f031cf /Objects/listobject.c
parentd1f9942ae399c765c1bee392658fc0f56f963ec5 (diff)
downloadcpython-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.c6
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;