diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1284,13 +1284,18 @@ static PyObject * min_max(PyObject *args, PyObject *kwds, int op) { - PyObject *v, *it, *item, *val, *maxitem, *maxval, *keyfunc=NULL; + PyObject *v=NULL, *it, *item, *val, *maxitem, *maxval, *keyfunc=NULL; const char *name = op == Py_LT ? "min" : "max"; if (PyTuple_Size(args) > 1) v = args; - else if (!PyArg_UnpackTuple(args, (char *)name, 1, 1, &v)) + else if (!PyArg_UnpackTuple(args, (char *)name, 0, 1, &v)) return NULL; + else if (v == NULL) { + PyErr_Format(PyExc_TypeError, + "%s() requires at least a positional argument", name); + return NULL; + } if (kwds != NULL && PyDict_Check(kwds) && PyDict_Size(kwds)) { keyfunc = PyDict_GetItemString(kwds, "key");