summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorAlexander Marshalov <_@marshalov.org>2018-07-24 10:58:21 +0700
committerRaymond Hettinger <rhettinger@users.noreply.github.com>2018-07-23 20:58:21 -0700
commite22072fb11246f125aa9ff7629c832b9e2407ef0 (patch)
tree8cbe81568e233643182d0c952b62c6fdf3ba060a /Python
parentbde782bb594edffeabe978abeee2b7082ab9bc2a (diff)
downloadcpython-git-e22072fb11246f125aa9ff7629c832b9e2407ef0.tar.gz
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().
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c4
1 files changed, 4 insertions, 0 deletions
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) )) {