]> granicus.if.org Git - python/commitdiff
Issue: 2354: Add 3K warning for the cmp argument to list.sort() and sorted().
authorRaymond Hettinger <python@rcn.com>
Tue, 18 Mar 2008 23:33:08 +0000 (23:33 +0000)
committerRaymond Hettinger <python@rcn.com>
Tue, 18 Mar 2008 23:33:08 +0000 (23:33 +0000)
Objects/listobject.c

index 9a8b64e76f5f668ea675d14a745388b866259f72..9e8659210122921e5b2df293a0e1121e782ca945 100644 (file)
@@ -2037,6 +2037,11 @@ listsort(PyListObject *self, PyObject *args, PyObject *kwds)
        }
        if (compare == Py_None)
                compare = NULL;
+       if (compare == NULL && 
+            Py_Py3kWarningFlag &&
+           PyErr_Warn(PyExc_DeprecationWarning, 
+                      "In 3.x, the cmp argument is no longer supported.") < 0)
+               return NULL;
        if (keyfunc == Py_None)
                keyfunc = NULL;
        if (compare != NULL && keyfunc != NULL) {