copy function arguments into closure also when no conversion is needed
authorStefan Behnel <scoder@users.berlios.de>
Thu, 30 Apr 2009 15:53:55 +0000 (17:53 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Thu, 30 Apr 2009 15:53:55 +0000 (17:53 +0200)
Cython/Compiler/Nodes.py

index a3f1adb1b6d43a85cee7b768f8393e8a4898da33..0f784d811740aaeffb23a877b57157b9f2479c68 100644 (file)
@@ -2332,11 +2332,14 @@ class DefNode(FuncDefNode):
                 code.putln('}')
 
     def generate_argument_conversion_code(self, code):
-        # Generate code to convert arguments from
-        # signature type to declared type, if needed.
+        # Generate code to convert arguments from signature type to
+        # declared type, if needed.  Also copies signature arguments
+        # into closure fields.
         for arg in self.args:
             if arg.needs_conversion:
                 self.generate_arg_conversion(arg, code)
+            elif arg.entry.in_closure:
+                code.putln('%s = %s;' % (arg.entry.cname, arg.hdr_cname))
 
     def generate_arg_conversion(self, arg, code):
         # Generate conversion code for one argument.