Tweak #654 fix, c functions can't be assinged to.
authorRobert Bradshaw <robertwb@math.washington.edu>
Thu, 27 Jan 2011 19:49:23 +0000 (11:49 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Thu, 27 Jan 2011 19:49:23 +0000 (11:49 -0800)
Cython/Compiler/ExprNodes.py

index 0f019829ba88eefd4661abea7d6f86e329fb2d76..aaf18932ddb0f850a6bbc259750916bfce868c74 100755 (executable)
@@ -2979,13 +2979,18 @@ class SimpleCallNode(CallNode):
             # sure they are either all temps or all not temps
             for i in range(min(max_nargs, actual_nargs)):
                 arg = self.args[i]
-                # local variables are safe
-                if not arg.is_name or arg.entry and (not arg.entry.is_local or arg.entry.in_closure):
+                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?
+                    pass
+                elif env.nogil and arg.type.is_pyobject:
                     # can't copy a Python reference into a temp in nogil
                     # env (this is safe: a construction would fail in
                     # nogil anyway)
-                    if not (env.nogil and arg.type.is_pyobject):
-                        self.args[i] = arg.coerce_to_temp(env)
+                    pass
+                else:
+                    self.args[i] = arg.coerce_to_temp(env)
         for i in range(max_nargs, actual_nargs):
             arg = self.args[i]
             if arg.type.is_pyobject: