diff options
author | Alexander Marshalov <_@marshalov.org> | 2018-07-24 03:58:21 (GMT) |
---|---|---|
committer | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2018-07-24 03:58:21 (GMT) |
commit | e22072fb11246f125aa9ff7629c832b9e2407ef0 (patch) | |
tree | 8cbe81568e233643182d0c952b62c6fdf3ba060a /Python | |
parent | bde782bb594edffeabe978abeee2b7082ab9bc2a (diff) | |
download | cpython-e22072fb11246f125aa9ff7629c832b9e2407ef0.zip cpython-e22072fb11246f125aa9ff7629c832b9e2407ef0.tar.gz cpython-e22072fb11246f125aa9ff7629c832b9e2407ef0.tar.bz2 |
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.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 88a4bf9..7bb5687 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) )) { |