From fe68a83eca5d98dcdcdfa568d9006425df23e09f Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Mon, 6 Apr 2009 19:13:25 +0200 Subject: [PATCH] disable some constant folding operations that can break code --- Cython/Compiler/ExprNodes.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 0b03f894..94aaf861 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -877,7 +877,9 @@ class FloatNode(ConstNode): type = PyrexTypes.c_double_type def calculate_constant_result(self): - self.constant_result = float(self.value) + # calculating float values is usually not a good idea + #self.constant_result = float(self.value) + pass def compile_time_value(self, denv): return float(self.value) @@ -3889,7 +3891,9 @@ class TypecastNode(NewTempExprNode): self.operand.check_const() def calculate_constant_result(self): - self.constant_result = self.operand.constant_result + # we usually do not know the result of a type cast at code + # generation time + pass def calculate_result_code(self): opnd = self.operand @@ -4949,7 +4953,8 @@ class CoercionNode(NewTempExprNode): print("%s Coercing %s" % (self, self.arg)) def calculate_constant_result(self): - self.constant_result = self.arg.constant_result + # constant folding can break type coercion, so this is disabled + pass def annotate(self, code): self.arg.annotate(code) -- 2.26.2