cleanup
authorStefan Behnel <scoder@users.berlios.de>
Wed, 16 Jan 2008 07:44:13 +0000 (08:44 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Wed, 16 Jan 2008 07:44:13 +0000 (08:44 +0100)
Cython/Compiler/Nodes.py

index 02fefce450de101425dd743a0604c88ad60c4825..8f03bec005daef6bbe57dbb6aa0905c452625f9a 100644 (file)
@@ -1280,10 +1280,10 @@ class DefNode(FuncDefNode):
             return 0
 
     def generate_stararg_getting_code(self, code):
-        error_return = "return %s;" % self.error_value()
         num_kwonly = self.num_kwonly_args
         fixed_args = self.entry.signature.num_fixed_args()
         nargs = len(self.args) - num_kwonly - fixed_args
+        error_return = "return %s;" % self.error_value()
 
         if self.star_arg:
             star_arg_addr = self.arg_address(self.star_arg)
@@ -1294,8 +1294,9 @@ class DefNode(FuncDefNode):
                     star_arg_addr,
                     self.error_value()))
         elif self.entry.signature.has_generic_args:
-            # provide a more helpful message about supernumerous
-            # positional arguments than PyArg_ParseTupelAndKeywords()
+            # make sure supernumerous positional arguments do not run
+            # into keyword-only arguments and provide a more helpful
+            # message than PyArg_ParseTupelAndKeywords()
             code.putln("if (unlikely(PyTuple_GET_SIZE(%s) > %d)) {" % (
                     Naming.args_cname, nargs))
             error_message = "function takes at most %d positional arguments (%d given)"