avoid minor redundancy in generated code
authorStefan Behnel <scoder@users.berlios.de>
Sun, 28 Dec 2008 15:53:54 +0000 (16:53 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Sun, 28 Dec 2008 15:53:54 +0000 (16:53 +0100)
Cython/Compiler/Nodes.py

index 573ff938a80222a0642faee0fbbfa1d3cc5cef56..84b16f18fdb863f42d5581660d48d96009fd4862 100644 (file)
@@ -2021,10 +2021,11 @@ class DefNode(FuncDefNode):
         elif min_positional_args == max_positional_args:
             # parse the exact number of positional arguments from the
             # args tuple
-            code.putln('} else {')
-            for i, arg in enumerate(positional_args):
-                item = "PyTuple_GET_ITEM(%s, %d)" % (Naming.args_cname, i)
-                self.generate_arg_assignment(arg, item, code)
+            if max_positional_args > 0:
+                code.putln('} else {')
+                for i, arg in enumerate(positional_args):
+                    item = "PyTuple_GET_ITEM(%s, %d)" % (Naming.args_cname, i)
+                    self.generate_arg_assignment(arg, item, code)
 
         else:
             # parse the positional arguments from the variable length