summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-03-18 23:33:08 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-03-18 23:33:08 (GMT)
commit6c0ff8aacd5b493892878e138b97af66e4bfaf37 (patch)
treeba827b54c744420ba2cd844efffcecc8f33e36a1 /Objects
parent9a47e6201f7604f96d302d90eea2a1dd382c491f (diff)
downloadcpython-6c0ff8aacd5b493892878e138b97af66e4bfaf37.zip
cpython-6c0ff8aacd5b493892878e138b97af66e4bfaf37.tar.gz
cpython-6c0ff8aacd5b493892878e138b97af66e4bfaf37.tar.bz2
Issue: 2354: Add 3K warning for the cmp argument to list.sort() and sorted().
Diffstat (limited to 'Objects')
-rw-r--r--Objects/listobject.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 9a8b64e..9e86592 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -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) {