]> granicus.if.org Git - python/commitdiff
bpo-31236: Improved some error messages of min() and max().
authorOren Milman <orenmn@gmail.com>
Mon, 21 Aug 2017 17:19:07 +0000 (20:19 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Mon, 21 Aug 2017 17:19:07 +0000 (20:19 +0300)
Python/bltinmodule.c

index 85f207b68ee3590cfe964dfc0d9b13a2c534d604..5e1f1d3854fc675b8041e3acef25e213e6b1b167 100644 (file)
@@ -1519,8 +1519,9 @@ min_max(PyObject *args, PyObject *kwds, int op)
     emptytuple = PyTuple_New(0);
     if (emptytuple == NULL)
         return NULL;
-    ret = PyArg_ParseTupleAndKeywords(emptytuple, kwds, "|$OO", kwlist,
-                                      &keyfunc, &defaultval);
+    ret = PyArg_ParseTupleAndKeywords(emptytuple, kwds,
+                                      (op == Py_LT) ? "|$OO:min" : "|$OO:max",
+                                      kwlist, &keyfunc, &defaultval);
     Py_DECREF(emptytuple);
     if (!ret)
         return NULL;