mirror of https://github.com/python/cpython
Issue #18408: Fix heapq.heappop(), handle PyList_SetSlice() failure
This commit is contained in:
parent
2ff51b83b8
commit
764a46d2ed
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue