diff options
author | Georg Brandl <georg@python.org> | 2008-03-30 19:43:27 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-03-30 19:43:27 (GMT) |
commit | 1721e757499db93373cba263b0553a64d4c545a3 (patch) | |
tree | 91b44caff75ef22107938d1f7a528b89bbe2a4f2 | |
parent | 1c88e0f52cfa6e7c9fca6da94946eff3f34f6daf (diff) | |
download | cpython-1721e757499db93373cba263b0553a64d4c545a3.zip cpython-1721e757499db93373cba263b0553a64d4c545a3.tar.gz cpython-1721e757499db93373cba263b0553a64d4c545a3.tar.bz2 |
Fix error message -- "expects either 0 or 0 arguments"
-rwxr-xr-x | Parser/asdl_c.py | 6 | ||||
-rw-r--r-- | Python/Python-ast.c | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index 08592bc..29e2547 100755 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -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; diff --git a/Python/Python-ast.c b/Python/Python-ast.c index d473418..ba310e6 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -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; |