[Python-checkins] cpython: Close #19578: Fix list_ass_subscript(), handle list_resize() failure

victor.stinner python-checkins at python.org
Thu Nov 21 12:16:52 CET 2013


http://hg.python.org/cpython/rev/b508253f2876
changeset:   87308:b508253f2876
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu Nov 21 12:16:35 2013 +0100
summary:
  Close #19578: Fix list_ass_subscript(), handle list_resize() failure

Notify the caller of the failure (MemoryError exception).

files:
  Objects/listobject.c |  5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/Objects/listobject.c b/Objects/listobject.c
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -2483,6 +2483,7 @@
             PyObject **garbage;
             size_t cur;
             Py_ssize_t i;
+            int res;
 
             if (slicelength <= 0)
                 return 0;
@@ -2533,14 +2534,14 @@
             }
 
             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 */

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list