fix tweak: closure variables are not safe as function arguments; the last argument...
authorStefan Behnel <scoder@users.berlios.de>
Thu, 27 Jan 2011 20:07:52 +0000 (21:07 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Thu, 27 Jan 2011 20:07:52 +0000 (21:07 +0100)
Cython/Compiler/ExprNodes.py

index 1953630affd24f13f59204fc713bd87324c18af6..fe5463bf94a7efe7c2fb5f47b261afb83fb6cb98 100755 (executable)
@@ -2977,12 +2977,12 @@ class SimpleCallNode(CallNode):
             # if some args are temps and others are not, they may get
             # constructed in the wrong order (temps first) => make
             # sure they are either all temps or all not temps
-            for i in range(min(max_nargs, actual_nargs)):
+            for i in range(min(max_nargs, actual_nargs)-1):
                 arg = self.args[i]
                 if arg.is_name and arg.entry and (
-                    arg.entry.is_local or arg.entry.in_closure or arg.entry.type.is_cfunction):
-                    # local variables are safe
-                    # TODO: what about the non-local keyword?
+                    (arg.entry.is_local and not arg.entry.in_closure)
+                    or arg.entry.type.is_cfunction):
+                    # local variables and C functions are safe
                     pass
                 elif env.nogil and arg.type.is_pyobject:
                     # can't copy a Python reference into a temp in nogil