mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-39200: Correct the error message for min/max builtin function (GH-17814)
Correct the error message when calling the min() or max() with no arguments.
This commit is contained in:
parent
c39b52f152
commit
abdc634f33
3 changed files with 21 additions and 4 deletions
|
@ -1589,10 +1589,15 @@ min_max(PyObject *args, PyObject *kwds, int op)
|
|||
const int positional = PyTuple_Size(args) > 1;
|
||||
int ret;
|
||||
|
||||
if (positional)
|
||||
if (positional) {
|
||||
v = args;
|
||||
else if (!PyArg_UnpackTuple(args, name, 1, 1, &v))
|
||||
}
|
||||
else if (!PyArg_UnpackTuple(args, name, 1, 1, &v)) {
|
||||
if (PyExceptionClass_Check(PyExc_TypeError)) {
|
||||
PyErr_Format(PyExc_TypeError, "%s expected at least 1 argument, got 0", name);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
emptytuple = PyTuple_New(0);
|
||||
if (emptytuple == NULL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue