[Python-checkins] r62054 - in python/trunk: Parser/asdl_c.py Python/Python-ast.c

georg.brandl python-checkins at python.org
Sun Mar 30 21:43:27 CEST 2008


Author: georg.brandl
Date: Sun Mar 30 21:43:27 2008
New Revision: 62054

Modified:
   python/trunk/Parser/asdl_c.py
   python/trunk/Python/Python-ast.c
Log:
Fix error message -- "expects either 0 or 0 arguments"


Modified: python/trunk/Parser/asdl_c.py
==============================================================================
--- python/trunk/Parser/asdl_c.py	(original)
+++ python/trunk/Parser/asdl_c.py	Sun Mar 30 21:43:27 2008
@@ -595,8 +595,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;

Modified: python/trunk/Python/Python-ast.c
==============================================================================
--- python/trunk/Python/Python-ast.c	(original)
+++ python/trunk/Python/Python-ast.c	Sun Mar 30 21:43:27 2008
@@ -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;


More information about the Python-checkins mailing list