Commit b9db9e15 authored by Raymond Hettinger's avatar Raymond Hettinger

Defend against a mutation during comparison

parent 1af2bf75
......@@ -224,6 +224,11 @@ heappushpop(PyObject *self, PyObject *args)
return item;
}
if (PyList_GET_SIZE(heap) == 0) {
PyErr_SetString(PyExc_IndexError, "index out of range");
return NULL;
}
returnitem = PyList_GET_ITEM(heap, 0);
Py_INCREF(item);
PyList_SET_ITEM(heap, 0, item);
......
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