From e0e71d4fe4992f0a181252648fe2851340869a72 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 18 Dec 2008 09:58:55 +0100 Subject: [PATCH] better error messages during constant folding, forward constants also through type coercion --- Cython/Compiler/ExprNodes.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 00d8f2e9..d9c4f9b8 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -27,7 +27,8 @@ try: except NameError: from sets import Set as set -not_a_constant = object() +class NotConstant(object): pass # just for the name +not_a_constant = NotConstant() constant_value_not_set = object() class ExprNode(Node): @@ -4839,6 +4840,9 @@ class CoercionNode(NewTempExprNode): self.arg = arg if debug_coercion: print("%s Coercing %s" % (self, self.arg)) + + def calculate_constant_result(self): + self.constant_result = self.arg.constant_result def annotate(self, code): self.arg.annotate(code) -- 2.26.2