Fix error message -- "expects either 0 or 0 arguments"

This commit is contained in:
Georg Brandl 2008-03-30 19:43:27 +00:00
parent 1c88e0f52c
commit 1721e75749
2 changed files with 8 additions and 4 deletions

View File

@ -595,8 +595,10 @@ ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
res = 0; /* if no error occurs, this stays 0 to the end */
if (PyTuple_GET_SIZE(args) > 0) {
if (numfields != PyTuple_GET_SIZE(args)) {
PyErr_Format(PyExc_TypeError, "%.400s constructor takes either 0 or "
"%d positional argument%s", Py_TYPE(self)->tp_name,
PyErr_Format(PyExc_TypeError, "%.400s constructor takes %s"
"%" PY_FORMAT_SIZE_T "d positional argument%s",
Py_TYPE(self)->tp_name,
numfields == 0 ? "" : "either 0 or ",
numfields, numfields == 1 ? "" : "s");
res = -1;
goto cleanup;

View File

@ -386,8 +386,10 @@ ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
res = 0; /* if no error occurs, this stays 0 to the end */
if (PyTuple_GET_SIZE(args) > 0) {
if (numfields != PyTuple_GET_SIZE(args)) {
PyErr_Format(PyExc_TypeError, "%.400s constructor takes either 0 or "
"%d positional argument%s", Py_TYPE(self)->tp_name,
PyErr_Format(PyExc_TypeError, "%.400s constructor takes %s"
"%" PY_FORMAT_SIZE_T "d positional argument%s",
Py_TYPE(self)->tp_name,
numfields == 0 ? "" : "either 0 or ",
numfields, numfields == 1 ? "" : "s");
res = -1;
goto cleanup;