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

This commit is contained in:
Raymond Hettinger 2008-03-18 23:33:08 +00:00
parent 9a47e6201f
commit 6c0ff8aacd
1 changed files with 5 additions and 0 deletions

View 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) {