[Python-checkins] cpython: Issue #18408: Fix listpop(), handle list_ass_slice() failure

victor.stinner python-checkins at python.org
Wed Jul 17 22:11:55 CEST 2013


http://hg.python.org/cpython/rev/97bb3bdf1443
changeset:   84695:97bb3bdf1443
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Wed Jul 17 21:58:01 2013 +0200
summary:
  Issue #18408: Fix listpop(), handle list_ass_slice() failure

files:
  Objects/listobject.c |  10 ++++------
  1 files changed, 4 insertions(+), 6 deletions(-)


diff --git a/Objects/listobject.c b/Objects/listobject.c
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -934,12 +934,10 @@
     }
     Py_INCREF(v);
     status = list_ass_slice(self, i, i+1, (PyObject *)NULL);
-    assert(status >= 0);
-    /* Use status, so that in a release build compilers don't
-     * complain about the unused name.
-     */
-    (void) status;
-
+    if (status < 0) {
+        Py_DECREF(v);
+        return NULL;
+    }
     return v;
 }
 

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


More information about the Python-checkins mailing list