From: Victor Stinner Date: Wed, 17 Jul 2013 19:58:01 +0000 (+0200) Subject: Issue #18408: Fix listpop(), handle list_ass_slice() failure X-Git-Tag: v3.4.0a1~164 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=095d99ffffbcee6d33523c439dc6a81a6787c5b6;p=python Issue #18408: Fix listpop(), handle list_ass_slice() failure --- diff --git a/Objects/listobject.c b/Objects/listobject.c index 0ec70e587a..ce6b70889e 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -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; }