]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[Backport rev. 41696 by neal.norwitz]
authorAndrew M. Kuchling <amk@amk.ca>
Fri, 29 Sep 2006 17:52:32 +0000 (17:52 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Fri, 29 Sep 2006 17:52:32 +0000 (17:52 +0000)
Fix an int/long mismatch identified here:
        http://www.tortall.net/mu/blog/2005/12/01

Pointed out from SF #1365916.

Backport candidate.

Misc/NEWS
Python/bltinmodule.c

index 4e454bec1ad3ce4e022f6930fef2ba2c797b8095..80aeba9156bc646cc016e568859c771b85af15cd 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,8 @@ What's New in Python 2.4.4c1?
 Core and builtins
 -----------------
 
+- Bug #1365916: Fix an int/long mismatch in the sorted() built-in.
+
 - Fix memory leak of coding spec in Parser/tokenizer.c.
  
 - Overflow checking code in integer division ran afoul of new gcc
index 6d30391712c6bb3a7b645c47936dc36d6d332cc7..bf61640b30ba3ec5e62961f4126320be70c097b2 100644 (file)
@@ -1811,9 +1811,10 @@ builtin_sorted(PyObject *self, PyObject *args, PyObject *kwds)
        PyObject *newlist, *v, *seq, *compare=NULL, *keyfunc=NULL, *newargs;
        PyObject *callable;
        static char *kwlist[] = {"iterable", "cmp", "key", "reverse", 0};
-       long reverse;
+       int reverse;
 
        if (args != NULL) {
+               /* args 1-4 should match listsort in Objects/listobject.c */
                if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OOi:sorted",
                        kwlist, &seq, &compare, &keyfunc, &reverse))
                        return NULL;