diff options
author | Raymond Hettinger <python@rcn.com> | 2015-05-12 02:59:21 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2015-05-12 02:59:21 (GMT) |
commit | 4e6bf4b3da03b132b0698f30ee931a350585b117 (patch) | |
tree | e10485ec3c7bd9b2384eccfcf3856e879641a061 /Modules | |
parent | dc6a9c04234ffc95b4a6a74c19c234cd9aa6e8c2 (diff) | |
parent | b9db9e152f3325b075e59ef4fdecfd0b9ec4746c (diff) | |
download | cpython-4e6bf4b3da03b132b0698f30ee931a350585b117.zip cpython-4e6bf4b3da03b132b0698f30ee931a350585b117.tar.gz cpython-4e6bf4b3da03b132b0698f30ee931a350585b117.tar.bz2 |
merge
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_heapqmodule.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/_heapqmodule.c b/Modules/_heapqmodule.c index 5e724a1..01b35be 100644 --- a/Modules/_heapqmodule.c +++ b/Modules/_heapqmodule.c @@ -235,6 +235,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); |