mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2024-11-26 22:50:40 +00:00
Fix 2.6- chained compare in lambda
This commit is contained in:
parent
832734ccb4
commit
733e0ebf9d
BIN
test/bytecode_2.6/02_ifelse_lambda.pyc
Normal file
BIN
test/bytecode_2.6/02_ifelse_lambda.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -16,5 +16,4 @@ h = lambda: 1 if False else 3
|
||||
h()
|
||||
|
||||
# From 2.7 test_builtin
|
||||
def test_filter(self):
|
||||
self.assertEqual(filter(lambda c: 'a' <= c <= 'z', 'Hello World'), 'elloorld')
|
||||
lambda c: 'a' <= c <= 'z', 'Hello World'
|
||||
|
@ -260,14 +260,15 @@ class Python26Parser(Python2Parser):
|
||||
# compare_chained is like x <= y <= z
|
||||
compare_chained ::= expr compare_chained1 ROT_TWO COME_FROM POP_TOP _come_froms
|
||||
compare_chained1 ::= expr DUP_TOP ROT_THREE COMPARE_OP
|
||||
jmp_false compare_chained1 _come_froms
|
||||
jmp_false_then compare_chained1 _come_froms
|
||||
compare_chained1 ::= expr DUP_TOP ROT_THREE COMPARE_OP
|
||||
jmp_false compare_chained2 _come_froms
|
||||
jmp_false_then compare_chained2 _come_froms
|
||||
|
||||
# FIXME: start here
|
||||
compare_chained2 ::= expr COMPARE_OP RETURN_VALUE
|
||||
compare_chained2 ::= expr COMPARE_OP RETURN_END_IF_LAMBDA
|
||||
compare_chained2 ::= expr COMPARE_OP RETURN_VALUE_LAMBDA
|
||||
return_lambda ::= RETURN_VALUE
|
||||
return_lambda ::= RETURN_END_IF_LAMBDA
|
||||
return_lambda ::= RETURN_VALUE_LAMBDA
|
||||
|
||||
compare_chained2 ::= expr COMPARE_OP return_lambda
|
||||
|
||||
return_if_lambda ::= RETURN_END_IF_LAMBDA POP_TOP
|
||||
stmt ::= conditional_lambda
|
||||
|
@ -82,8 +82,12 @@ class Python27Parser(Python2Parser):
|
||||
compare_chained1 COME_FROM
|
||||
compare_chained1 ::= expr DUP_TOP ROT_THREE COMPARE_OP JUMP_IF_FALSE_OR_POP
|
||||
compare_chained2 COME_FROM
|
||||
compare_chained2 ::= expr COMPARE_OP RETURN_VALUE
|
||||
compare_chained2 ::= expr COMPARE_OP RETURN_VALUE_LAMBDA
|
||||
|
||||
return_lambda ::= RETURN_VALUE
|
||||
return_lambda ::= RETURN_VALUE_LAMBDA
|
||||
|
||||
compare_chained2 ::= expr COMPARE_OP return_lambda
|
||||
compare_chained2 ::= expr COMPARE_OP return_lambda
|
||||
|
||||
# conditional_true are for conditions which always evaluate true
|
||||
# There is dead or non-optional remnants of the condition code though,
|
||||
|
Loading…
Reference in New Issue
Block a user