diff Python/Python-ast.c @ 46207:59d42e6d1885 legacy-trunk

Fix error message -- "expects either 0 or 0 arguments"
author Georg Brandl <georg@python.org>
date Sun, 30 Mar 2008 19:43:27 +0000
parents 29ea507fd998
children be18df634405
line wrap: on
line diff
--- a/Python/Python-ast.c	Sun Mar 30 19:41:39 2008 +0000
+++ b/Python/Python-ast.c	Sun Mar 30 19:43:27 2008 +0000
@@ -386,8 +386,10 @@
     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;