]> granicus.if.org Git - python/commitdiff
Issue #18408: Fix listpop(), handle list_ass_slice() failure
authorVictor Stinner <victor.stinner@gmail.com>
Wed, 17 Jul 2013 19:58:01 +0000 (21:58 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Wed, 17 Jul 2013 19:58:01 +0000 (21:58 +0200)
Objects/listobject.c

index 0ec70e587af815b330fe4c3fc4ca0a9b7902df0c..ce6b70889e8cf2c6813c4f968845c5ed994ecb2d 100644 (file)
@@ -934,12 +934,10 @@ listpop(PyListObject *self, PyObject *args)
     }
     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;
 }