From: Stefan Behnel Date: Thu, 18 Oct 2007 06:00:18 +0000 (+0200) Subject: Fix king1 - compile time == operator X-Git-Tag: 0.9.6.14~29^2~119^2~6 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=06ed8931bd16910c37d5406578661cc5a3e606eb;p=cython.git Fix king1 - compile time == operator --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 41aeb637..0da16592 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -2639,7 +2639,7 @@ class SizeofVarNode(SizeofNode): compile_time_binary_operators = { '<': operator.lt, '<=': operator.le, - '=': operator.eq, + '==': operator.eq, '!=': operator.ne, '>=': operator.ge, '>': operator.gt, @@ -2667,7 +2667,7 @@ def get_compile_time_binop(node): if not func: error(node.pos, "Binary '%s' not supported in compile-time expression" - % self.operator) + % node.operator) return func class BinopNode(ExprNode): @@ -3109,11 +3109,12 @@ class CmpNode: def cascaded_compile_time_value(self, operand1, denv): func = get_compile_time_binop(self) - operand2 = self.operand.compile_time_value(denv) + operand2 = self.operand2.compile_time_value(denv) try: result = func(operand1, operand2) except Exception, e: self.compile_time_value_error(e) + result = None if result: cascade = self.cascade if cascade: @@ -3221,7 +3222,7 @@ class PrimaryCmpNode(ExprNode, CmpNode): cascade = None def compile_time_value(self, denv): - operand1 = self.operand.compile_time_value(denv) + operand1 = self.operand1.compile_time_value(denv) return self.cascaded_compile_time_value(operand1, denv) def analyse_types(self, env):