mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
Verify heappop argument is a list.
This commit is contained in:
parent
cf0005baf4
commit
236a2443fb
1 changed files with 5 additions and 0 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue