[Python-checkins] r79244 - in python/branches/py3k: Lib/test/test_extcall.py Python/ceval.c

benjamin.peterson python-checkins at python.org
Sun Mar 21 22:16:24 CET 2010


Author: benjamin.peterson
Date: Sun Mar 21 22:16:24 2010
New Revision: 79244

Log:
count keyword only arguments as part of the total

Modified:
   python/branches/py3k/Lib/test/test_extcall.py
   python/branches/py3k/Python/ceval.c

Modified: python/branches/py3k/Lib/test/test_extcall.py
==============================================================================
--- python/branches/py3k/Lib/test/test_extcall.py	(original)
+++ python/branches/py3k/Lib/test/test_extcall.py	Sun Mar 21 22:16:24 2010
@@ -280,6 +280,12 @@
     Traceback (most recent call last):
       ...
     TypeError: f() takes exactly 1 argument (5 given)
+    >>> def f(a, *, kw):
+    ...    pass
+    >>> f(6, 4, kw=4)
+    Traceback (most recent call last):
+      ...
+    TypeError: f() takes exactly 2 arguments (3 given)
 """
 
 import sys

Modified: python/branches/py3k/Python/ceval.c
==============================================================================
--- python/branches/py3k/Python/ceval.c	(original)
+++ python/branches/py3k/Python/ceval.c	Sun Mar 21 22:16:24 2010
@@ -3078,8 +3078,8 @@
 				    "argument%s (%d given)",
 				    co->co_name,
 				    defcount ? "at most" : "exactly",
-				    co->co_argcount,
-				    co->co_argcount == 1 ? "" : "s",
+				    total_args,
+				    total_args == 1 ? "" : "s",
 				    argcount + kwcount);
 				goto fail;
 			}


More information about the Python-checkins mailing list