]> granicus.if.org Git - python/commitdiff
Use 'n' format for Py_ssize_t variables to PyArg_ParseTuple(). Py_ssize_t
authorThomas Wouters <thomas@python.org>
Thu, 16 Feb 2006 17:32:54 +0000 (17:32 +0000)
committerThomas Wouters <thomas@python.org>
Thu, 16 Feb 2006 17:32:54 +0000 (17:32 +0000)
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)

Modules/_heapqmodule.c

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