Commit e42d343b authored by Raymond Hettinger's avatar Raymond Hettinger

merge

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