]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Verify heappop argument is a list.
authorRaymond Hettinger <python@rcn.com>
Sat, 15 Nov 2003 12:33:01 +0000 (12:33 +0000)
committerRaymond Hettinger <python@rcn.com>
Sat, 15 Nov 2003 12:33:01 +0000 (12:33 +0000)
Modules/heapqmodule.c

index 8a6a4f5cc13df856ca92656299497c74bef3378f..629f516457c1c9d93a54697d6b914124a02aef12 100644 (file)
@@ -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) {