summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-11-15 12:33:01 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-11-15 12:33:01 (GMT)
commit236a2443fbe32577bc4b5b9a1b58aa93f9d91de0 (patch)
tree3776441d4fb5922abfba520007653c965a302c40
parentcf0005baf40bffc503e062b3520a312a5f2cfd2b (diff)
downloadcpython-236a2443fbe32577bc4b5b9a1b58aa93f9d91de0.zip
cpython-236a2443fbe32577bc4b5b9a1b58aa93f9d91de0.tar.gz
cpython-236a2443fbe32577bc4b5b9a1b58aa93f9d91de0.tar.bz2
Verify heappop argument is a list.
-rw-r--r--Modules/heapqmodule.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/heapqmodule.c b/Modules/heapqmodule.c
index 8a6a4f5..629f516 100644
--- a/Modules/heapqmodule.c
+++ b/Modules/heapqmodule.c
@@ -119,6 +119,11 @@ heappop(PyObject *self, PyObject *heap)
PyObject *lastelt, *returnitem;
int n;
+ if (!PyList_Check(heap)) {
+ PyErr_SetString(PyExc_ValueError, "heap argument must be a list");
+ return NULL;
+ }
+
/* # raises appropriate IndexError if heap is empty */
n = PyList_GET_SIZE(heap);
if (n == 0) {