Use 'n' format for Py_ssize_t variables to PyArg_ParseTuple(). Py_ssize_t

has been applied fairly arbitrarily in this module (nsmallest uses
Py_ssize_t, nlargest does not) and it probably deserves a more complete
review. Fixes heapq.nsmallest() always returning the empty list (on
platforms with 64-bit ssize_t/long)
This commit is contained in:
Thomas Wouters 2006-02-16 17:32:54 +00:00
parent 7a2f83b706
commit ed6254acf2
1 changed files with 1 additions and 1 deletions

View File

@ -393,7 +393,7 @@ nsmallest(PyObject *self, PyObject *args)
PyObject *heap=NULL, *elem, *iterable, *los, *it, *oldelem; PyObject *heap=NULL, *elem, *iterable, *los, *it, *oldelem;
Py_ssize_t i, n; Py_ssize_t i, n;
if (!PyArg_ParseTuple(args, "iO:nsmallest", &n, &iterable)) if (!PyArg_ParseTuple(args, "nO:nsmallest", &n, &iterable))
return NULL; return NULL;
it = PyObject_GetIter(iterable); it = PyObject_GetIter(iterable);