Handle a wierd 2.6 conditional false expression...

from 2.6. test_grammar
This commit is contained in:
rocky
2017-12-03 19:54:26 -05:00
parent 0df29f344e
commit c791a45aae
7 changed files with 30 additions and 9 deletions

View File

@@ -0,0 +1,12 @@
# From Python 2.6 test_grammar where it says:
# Grammar allows multiple adjacent 'if's in listcomps and genexps,
# even though it's silly. Make sure it works (ifelse broke this.)
[ x for x in range(10) if x % 2 if x % 3 ]
list(x for x in range(10) if x % 2 if x % 3)
# expresion which evaluates True unconditionally,
# but leave dead code or junk around that we have to match on.
# Tests "conditional_true" rule
(5 if 1 else max(5, 2))