From e22072fb11246f125aa9ff7629c832b9e2407ef0 Mon Sep 17 00:00:00 2001 From: Alexander Marshalov <_@marshalov.org> Date: Tue, 24 Jul 2018 10:58:21 +0700 Subject: 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(). --- Python/bltinmodule.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Python/bltinmodule.c') diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 88a4bf991d..7bb5687d9a 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -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) )) { -- cgit v1.2.1