when deciding if function argument must be moved into temps, ignore if the first...
authorStefan Behnel <scoder@users.berlios.de>
Fri, 28 Jan 2011 21:06:49 +0000 (22:06 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Fri, 28 Jan 2011 21:06:49 +0000 (22:06 +0100)
Cython/Compiler/ExprNodes.py

index 965c9b49394477bda22bc4ff5094f7f17fcf03c2..4384c8a418a139b1e16b9852f1654e848f38da17 100755 (executable)
@@ -2970,7 +2970,8 @@ class SimpleCallNode(CallNode):
             formal_type = func_type.args[i].type
             arg = self.args[i].coerce_to(formal_type, env).coerce_to_simple(env)
             if arg.is_temp:
-                some_args_in_temps = True
+                if i > 0: # first argument doesn't matter
+                    some_args_in_temps = True
             elif arg.type.is_pyobject and not env.nogil:
                 if i == 0 and self.self is not None:
                     # a method's cloned "self" argument is ok
@@ -2983,7 +2984,8 @@ class SimpleCallNode(CallNode):
                     # but we must make sure it cannot be collected
                     # before we return from the function, so we create
                     # an owned temp reference to it
-                    some_args_in_temps = True
+                    if i > 0: # first argument doesn't matter
+                        some_args_in_temps = True
                     arg = arg.coerce_to_temp(env)
             self.args[i] = arg
         if some_args_in_temps: