cleanup
authorStefan Behnel <scoder@users.berlios.de>
Fri, 26 Dec 2008 14:25:36 +0000 (15:25 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Fri, 26 Dec 2008 14:25:36 +0000 (15:25 +0100)
Cython/Compiler/Nodes.py

index 3b5cb85f96eef494a0c9963dffd48e6bc302304f..66b837f789e58a8a339e6e648efd695b66bab2a8 100644 (file)
@@ -2121,11 +2121,11 @@ class DefNode(FuncDefNode):
         code.putln('}')
 
         # now fill up the required arguments with values from the kw dict
-        last_required_arg = -1
-        for i, arg in enumerate(all_args):
-            if not arg.default:
-                last_required_arg = i
-        if last_required_arg >= 0:
+        if self.num_required_args:
+            last_required_arg = -1
+            for i, arg in enumerate(all_args):
+                if not arg.default:
+                    last_required_arg = i
             code.putln('switch (PyTuple_GET_SIZE(%s)) {' % Naming.args_cname)
             for i, arg in enumerate(all_args[:last_required_arg+1]):
                 if i <= max_positional_args: