From f726f4096d17fa7b6f2a86da0c6f0396bd3c75ac Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Fri, 28 Jan 2011 22:06:49 +0100 Subject: [PATCH] when deciding if function argument must be moved into temps, ignore if the first argument is a temp as it will be evaluated first anyway --- Cython/Compiler/ExprNodes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 965c9b49..4384c8a4 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -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: -- 2.26.2