Kaydet (Commit) 764a46d2 authored tarafından Victor Stinner's avatar Victor Stinner

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

üst 2ff51b83
...@@ -168,7 +168,10 @@ heappop(PyObject *self, PyObject *heap) ...@@ -168,7 +168,10 @@ heappop(PyObject *self, PyObject *heap)
lastelt = PyList_GET_ITEM(heap, n-1) ; lastelt = PyList_GET_ITEM(heap, n-1) ;
Py_INCREF(lastelt); 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--; n--;
if (!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