diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-11-21 11:16:35 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-11-21 11:16:35 (GMT) |
commit | 35f2803a2454231de6c0c29e91a819c847e4da18 (patch) | |
tree | 6b0e5ceccab42a4e0517ad2229c81265ea6db5c0 /Objects | |
parent | a282825bf6fae1f0d492df8a6ced15df4fa94222 (diff) | |
download | cpython-35f2803a2454231de6c0c29e91a819c847e4da18.zip cpython-35f2803a2454231de6c0c29e91a819c847e4da18.tar.gz cpython-35f2803a2454231de6c0c29e91a819c847e4da18.tar.bz2 |
Close #19578: Fix list_ass_subscript(), handle list_resize() failure
Notify the caller of the failure (MemoryError exception).
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/listobject.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 7d5674c..5b75968 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -2483,6 +2483,7 @@ list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value) PyObject **garbage; size_t cur; Py_ssize_t i; + int res; if (slicelength <= 0) return 0; @@ -2533,14 +2534,14 @@ list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value) } Py_SIZE(self) -= slicelength; - list_resize(self, Py_SIZE(self)); + res = list_resize(self, Py_SIZE(self)); for (i = 0; i < slicelength; i++) { Py_DECREF(garbage[i]); } PyMem_FREE(garbage); - return 0; + return res; } else { /* assign slice */ |