[Python-checkins] cpython (merge 3.4 -> default): merge

raymond.hettinger python-checkins at python.org
Tue May 12 04:59:30 CEST 2015


https://hg.python.org/cpython/rev/50698bb955b0
changeset:   95967:50698bb955b0
parent:      95965:44c1db190525
parent:      95966:6df4045c7f85
user:        Raymond Hettinger <python at rcn.com>
date:        Mon May 11 19:59:21 2015 -0700
summary:
  merge

files:
  Modules/_heapqmodule.c |  5 +++++
  1 files changed, 5 insertions(+), 0 deletions(-)


diff --git a/Modules/_heapqmodule.c b/Modules/_heapqmodule.c
--- a/Modules/_heapqmodule.c
+++ b/Modules/_heapqmodule.c
@@ -235,6 +235,11 @@
         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);

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list