Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 095d99f

Browse files
committed
Issue #18408: Fix listpop(), handle list_ass_slice() failure
1 parent 479054b commit 095d99f

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

Objects/listobject.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -934,12 +934,10 @@ listpop(PyListObject *self, PyObject *args)
934934
}
935935
Py_INCREF(v);
936936
status = list_ass_slice(self, i, i+1, (PyObject *)NULL);
937-
assert(status >= 0);
938-
/* Use status, so that in a release build compilers don't
939-
* complain about the unused name.
940-
*/
941-
(void) status;
942-
937+
if (status < 0) {
938+
Py_DECREF(v);
939+
return NULL;
940+
}
943941
return v;
944942
}
945943

0 commit comments

Comments
 (0)