Commit fd39ad49 authored by Martin v. Löwis's avatar Martin v. Löwis

Patch #1005468: Disambiguate "min() or max()" exception string.

parent 9ecf3267
...@@ -1116,11 +1116,12 @@ Update and return a dictionary containing the current scope's local variables.") ...@@ -1116,11 +1116,12 @@ Update and return a dictionary containing the current scope's local variables.")
static PyObject * static PyObject *
min_max(PyObject *args, int op) min_max(PyObject *args, int op)
{ {
const char *name = op == Py_LT ? "min" : "max";
PyObject *v, *w, *x, *it; PyObject *v, *w, *x, *it;
if (PyTuple_Size(args) > 1) if (PyTuple_Size(args) > 1)
v = args; v = args;
else if (!PyArg_UnpackTuple(args, (op==Py_LT) ? "min" : "max", 1, 1, &v)) else if (!PyArg_UnpackTuple(args, (char *)name, 1, 1, &v))
return NULL; return NULL;
it = PyObject_GetIter(v); it = PyObject_GetIter(v);
...@@ -1158,8 +1159,8 @@ min_max(PyObject *args, int op) ...@@ -1158,8 +1159,8 @@ min_max(PyObject *args, int op)
} }
} }
if (w == NULL) if (w == NULL)
PyErr_SetString(PyExc_ValueError, PyErr_Format(PyExc_ValueError,
"min() or max() arg is an empty sequence"); "%s() arg is an empty sequence", name);
Py_DECREF(it); Py_DECREF(it);
return w; return w;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment