]> granicus.if.org Git - python/commitdiff
Fix error message -- "expects either 0 or 0 arguments"
authorGeorg Brandl <georg@python.org>
Sun, 30 Mar 2008 19:43:27 +0000 (19:43 +0000)
committerGeorg Brandl <georg@python.org>
Sun, 30 Mar 2008 19:43:27 +0000 (19:43 +0000)
Parser/asdl_c.py
Python/Python-ast.c

index 08592bc4c4a643f1684557ca7c77397738d7648d..29e2547595ca87f7e3f4aac06393ef08cf33e886 100755 (executable)
@@ -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;
index d4734187de785dcf90435b32a91b91e9c0f12420..ba310e60890232e15678e1a31d9eabdf3a4f95dc 100644 (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;