Commit fddf37ed authored by Stefan Behnel's avatar Stefan Behnel

fix compiler crash in FlattenInListTransform for non-trivial expressions

parent 7dd89787
......@@ -930,7 +930,15 @@ class FlattenInListTransform(Visitor.VisitorTransform, SkipDeclarations):
conds = []
temps = []
for arg in args:
if not arg.is_simple():
try:
# Trial optimisation to avoid redundant temp
# assignments. However, since is_simple() is meant to
# be called after type analysis, we ignore any errors
# and just play safe in that case.
is_simple_arg = arg.is_simple()
except Exception:
is_simple_arg = False
if not is_simple_arg:
# must evaluate all non-simple RHS before doing the comparisons
arg = UtilNodes.LetRefNode(arg)
temps.append(arg)
......
......@@ -13,7 +13,7 @@ def test_in(s):
>>> test_in('')
5
"""
if s in (u'ABC', u'BCD'):
if s in (u'ABC', u'BCD', u'ABC'[:3], u'ABC'[::-1], u'ABC'[-1]):
return 1
elif s.upper() in (u'ABC', u'BCD'):
return 2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment