Verify heappop argument is a list.
This commit is contained in:
parent
cf0005baf4
commit
236a2443fb
|
@ -119,6 +119,11 @@ heappop(PyObject *self, PyObject *heap)
|
||||||
PyObject *lastelt, *returnitem;
|
PyObject *lastelt, *returnitem;
|
||||||
int n;
|
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 */
|
/* # raises appropriate IndexError if heap is empty */
|
||||||
n = PyList_GET_SIZE(heap);
|
n = PyList_GET_SIZE(heap);
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
|
|
Loading…
Reference in New Issue