Commit 6c0ff8aa authored by Raymond Hettinger's avatar Raymond Hettinger

Issue: 2354: Add 3K warning for the cmp argument to list.sort() and sorted().

parent 9a47e620
......@@ -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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment