From 6a83f5ea1c1777207f802e18e670af0a2ea9cdf7 Mon Sep 17 00:00:00 2001 From: Dag Sverre Seljebotn Date: Sun, 30 Nov 2008 12:58:41 +0100 Subject: [PATCH] Fix suboptimal temp usage in BoolBinopNode. For further improvements see #147. --- Cython/Compiler/ExprNodes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index e734b3fa..0a682b04 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -4048,7 +4048,6 @@ class BoolBinopNode(NewTempExprNode): def generate_evaluation_code(self, code): code.mark_pos(self.pos) - self.allocate_temp_result(code) self.operand1.generate_evaluation_code(code) test_result, uses_temp = self.generate_operand1_test(code) if self.operator == 'and': @@ -4063,6 +4062,9 @@ class BoolBinopNode(NewTempExprNode): code.funcstate.release_temp(test_result) self.operand1.generate_disposal_code(code, free_temp=False) self.operand2.generate_evaluation_code(code) + + self.allocate_temp_result(code) + code.putln("%s = %s;" % (self.result(), self.operand2.result())) self.operand2.generate_disposal_code(code, decref=False) code.putln("} else {") -- 2.26.2