summaryrefslogtreecommitdiffstats
path: root/Modules/heapqmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/heapqmodule.c')
-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) {