From: Raymond Hettinger Date: Sat, 15 Nov 2003 12:33:01 +0000 (+0000) Subject: Verify heappop argument is a list. X-Git-Tag: v2.4a1~1279 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=236a2443fbe32577bc4b5b9a1b58aa93f9d91de0;p=thirdparty%2FPython%2Fcpython.git Verify heappop argument is a list. --- diff --git a/Modules/heapqmodule.c b/Modules/heapqmodule.c index 8a6a4f5cc13d..629f516457c1 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) {