[pypy-svn] r9933 - pypy/dist/pypy/interpreter

arigo at codespeak.net arigo at codespeak.net
Sun Mar 20 17:50:39 CET 2005


Author: arigo
Date: Sun Mar 20 17:50:39 2005
New Revision: 9933

Modified:
   pypy/dist/pypy/interpreter/argument.py
Log:
Minor fixes in */** calls error messages.


Modified: pypy/dist/pypy/interpreter/argument.py
==============================================================================
--- pypy/dist/pypy/interpreter/argument.py	(original)
+++ pypy/dist/pypy/interpreter/argument.py	Sun Mar 20 17:50:39 2005
@@ -264,13 +264,13 @@
         argnames, varargname, kwargname = signature
         args_w, kwds_w = args.unpack()
         nargs = len(args_w)
+        if kwargname is not None:
+            msg2 = "non-keyword "
+        else:
+            msg2 = ""
+            nargs += len(kwds_w)
         n = len(argnames)
         if n == 0:
-            if kwargname is not None:
-                msg2 = "non-keyword "
-            else:
-                msg2 = ""
-                nargs += len(kwds_w)
             msg = "%s() takes no %sargument (%d given)" % (
                 fnname, 
                 msg2,
@@ -284,10 +284,8 @@
             else:
                 msg1 = "at least"
                 n -= defcount
-            if kwargname is not None:
-                msg2 = "non-keyword "
-            else:
-                msg2 = ""
+                if not kwds_w:  # msg "f() takes at least X non-keyword args"
+                    msg2 = ""   # is confusing if no kwd arg actually provided
             if n == 1:
                 plural = ""
             else:



More information about the Pypy-commit mailing list