From: Stefan Behnel Date: Sat, 27 Mar 2010 06:51:41 +0000 (+0100) Subject: cleanup X-Git-Tag: 0.13.beta0~251^2~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1b5f0b92ac3822f188b8cae2fe0e08f3bc62dd87;p=cython.git cleanup --- diff --git a/Cython/Compiler/Optimize.py b/Cython/Compiler/Optimize.py index 7fa1a9d0..0efb23f1 100644 --- a/Cython/Compiler/Optimize.py +++ b/Cython/Compiler/Optimize.py @@ -526,12 +526,12 @@ class SwitchTransform(Visitor.VisitorTransform): if is_common_value(cond.operand1, cond.operand1): if cond.operand2.is_literal: return cond.operand1, [cond.operand2] - elif hasattr(cond.operand2, 'entry') and cond.operand2.entry and cond.operand2.entry.is_const: + elif getattr(cond.operand2, 'entry', None) and cond.operand2.entry.is_const: return cond.operand1, [cond.operand2] if is_common_value(cond.operand2, cond.operand2): if cond.operand1.is_literal: return cond.operand2, [cond.operand1] - elif hasattr(cond.operand1, 'entry') and cond.operand1.entry and cond.operand1.entry.is_const: + elif getattr(cond.operand1, 'entry', None) and cond.operand1.entry.is_const: return cond.operand2, [cond.operand1] elif (isinstance(cond, ExprNodes.BoolBinopNode) and cond.operator == 'or'):