diff options
author | Raymond Hettinger <python@rcn.com> | 2003-11-15 12:33:01 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-11-15 12:33:01 (GMT) |
commit | 236a2443fbe32577bc4b5b9a1b58aa93f9d91de0 (patch) | |
tree | 3776441d4fb5922abfba520007653c965a302c40 | |
parent | cf0005baf40bffc503e062b3520a312a5f2cfd2b (diff) | |
download | cpython-236a2443fbe32577bc4b5b9a1b58aa93f9d91de0.zip cpython-236a2443fbe32577bc4b5b9a1b58aa93f9d91de0.tar.gz cpython-236a2443fbe32577bc4b5b9a1b58aa93f9d91de0.tar.bz2 |
Verify heappop argument is a list.
-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 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) { |