summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2004-08-12 14:42:37 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2004-08-12 14:42:37 (GMT)
commitfd39ad4937f5f48142c7dafdac9d727931137c96 (patch)
tree1ba86c375cff3572ba00e4339a05a64216bdb256 /Python
parent9ecf326714bc3600028d399618eb83e6f21532ec (diff)
downloadcpython-fd39ad4937f5f48142c7dafdac9d727931137c96.zip
cpython-fd39ad4937f5f48142c7dafdac9d727931137c96.tar.gz
cpython-fd39ad4937f5f48142c7dafdac9d727931137c96.tar.bz2
Patch #1005468: Disambiguate "min() or max()" exception string.
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 04fcf59..f7715b6 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -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;
}