Mercurial > cpython-lru_cache-weakref
diff Python/bltinmodule.c @ 33099:ce016d0ec701 legacy-trunk
Patch #1005468: Disambiguate "min() or max()" exception string.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Thu, 12 Aug 2004 14:42:37 +0000 |
| parents | 5218bff56449 |
| children | 1cf7d7225a99 |
line wrap: on
line diff
--- a/Python/bltinmodule.c Thu Aug 12 14:07:49 2004 +0000 +++ b/Python/bltinmodule.c Thu Aug 12 14:42:37 2004 +0000 @@ -1116,11 +1116,12 @@ 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 @@ } } 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; }
