summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2015-05-12 02:59:21 (GMT)
committerRaymond Hettinger <python@rcn.com>2015-05-12 02:59:21 (GMT)
commit4e6bf4b3da03b132b0698f30ee931a350585b117 (patch)
treee10485ec3c7bd9b2384eccfcf3856e879641a061 /Modules
parentdc6a9c04234ffc95b4a6a74c19c234cd9aa6e8c2 (diff)
parentb9db9e152f3325b075e59ef4fdecfd0b9ec4746c (diff)
downloadcpython-4e6bf4b3da03b132b0698f30ee931a350585b117.zip
cpython-4e6bf4b3da03b132b0698f30ee931a350585b117.tar.gz
cpython-4e6bf4b3da03b132b0698f30ee931a350585b117.tar.bz2
merge
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_heapqmodule.c5
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);