Commit 6962ebac authored by Victor Stinner's avatar Victor Stinner

Issue #18408: Fix heapq.heappop(), handle PyList_SetSlice() failure

parent b2f56d74
......@@ -168,7 +168,10 @@ heappop(PyObject *self, PyObject *heap)
lastelt = PyList_GET_ITEM(heap, n-1) ;
Py_INCREF(lastelt);
PyList_SetSlice(heap, n-1, n, NULL);
if (PyList_SetSlice(heap, n-1, n, NULL) < 0) {
Py_DECREF(lastelt);
return NULL;
}
n--;
if (!n)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment