cython-devel
changeset 1221:fe6e3dd9d513
Fix ticket #72, (compiler crash on bad code)
| author | Robert Bradshaw <robertwb@math.washington.edu> |
|---|---|
| date | Wed Oct 08 00:05:25 2008 -0700 (3 years ago) |
| parents | e95e3d2cb88d |
| children | dc9d1f260c44 |
| files | Cython/Compiler/Optimize.py |
line diff
1.1 --- a/Cython/Compiler/Optimize.py Tue Oct 07 23:41:34 2008 -0700
1.2 +++ b/Cython/Compiler/Optimize.py Wed Oct 08 00:05:25 2008 -0700
1.3 @@ -39,12 +39,12 @@
1.4 if is_common_value(cond.operand1, cond.operand1):
1.5 if isinstance(cond.operand2, ExprNodes.ConstNode):
1.6 return cond.operand1, [cond.operand2]
1.7 - elif hasattr(cond.operand2, 'entry') and cond.operand2.entry.is_const:
1.8 + elif hasattr(cond.operand2, 'entry') and cond.operand2.entry and cond.operand2.entry.is_const:
1.9 return cond.operand1, [cond.operand2]
1.10 if is_common_value(cond.operand2, cond.operand2):
1.11 if isinstance(cond.operand1, ExprNodes.ConstNode):
1.12 return cond.operand2, [cond.operand1]
1.13 - elif hasattr(cond.operand1, 'entry') and cond.operand1.entry.is_const:
1.14 + elif hasattr(cond.operand1, 'entry') and cond.operand1.entry and cond.operand1.entry.is_const:
1.15 return cond.operand2, [cond.operand1]
1.16 elif (isinstance(cond, ExprNodes.BoolBinopNode)
1.17 and cond.operator == 'or'):
