bpo-34149: Behavior of the min/max with key=None (GH-8328)

Improve consistency with the signature for sorted(), heapq.nsmallest(), heapq.nlargest(), and itertools.groupby().
This commit is contained in:
Alexander Marshalov 2018-07-24 10:58:21 +07:00 committed by Raymond Hettinger
parent bde782bb59
commit e22072fb11
5 changed files with 17 additions and 8 deletions

View file

@ -1639,6 +1639,10 @@ min_max(PyObject *args, PyObject *kwds, int op)
return NULL;
}
if (keyfunc == Py_None) {
keyfunc = NULL;
}
maxitem = NULL; /* the result */
maxval = NULL; /* the value associated with the result */
while (( item = PyIter_Next(it) )) {