]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Patch #1005468: Disambiguate "min() or max()" exception string.
authorMartin v. Löwis <martin@v.loewis.de>
Thu, 12 Aug 2004 14:42:37 +0000 (14:42 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Thu, 12 Aug 2004 14:42:37 +0000 (14:42 +0000)
Python/bltinmodule.c

index 04fcf597b1ae9af8bed4704779cb096d810be62d..f7715b6de7ed739edf723d9b53b8ac3caa643cb3 100644 (file)
@@ -1116,11 +1116,12 @@ Update and return a dictionary containing the current scope's local variables.")
 static PyObject *
 min_max(PyObject *args, int op)
 {
+       const char *name = op == Py_LT ? "min" : "max";
        PyObject *v, *w, *x, *it;
 
        if (PyTuple_Size(args) > 1)
                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;
 
        it = PyObject_GetIter(v);
@@ -1158,8 +1159,8 @@ min_max(PyObject *args, int op)
                }
        }
        if (w == NULL)
-               PyErr_SetString(PyExc_ValueError,
-                               "min() or max() arg is an empty sequence");
+               PyErr_Format(PyExc_ValueError,
+                            "%s() arg is an empty sequence", name);
        Py_DECREF(it);
        return w;
 }