diff --git a/pytest/test_grammar.py b/pytest/test_grammar.py index 610923fd..58136d6c 100644 --- a/pytest/test_grammar.py +++ b/pytest/test_grammar.py @@ -29,7 +29,7 @@ def test_grammar(): expect_lhs.add('kv3') unused_rhs = unused_rhs.union(set(""" - except_pop_except generator_exp classdefdeco2 listcomp + except_pop_except generator_exp classdefdeco2 mapexpr """.split())) if 3.0 <= PYTHON_VERSION: diff --git a/uncompyle6/parsers/parse2.py b/uncompyle6/parsers/parse2.py index 3bf8d34f..b3199d41 100644 --- a/uncompyle6/parsers/parse2.py +++ b/uncompyle6/parsers/parse2.py @@ -351,6 +351,11 @@ class Python2Parser(PythonParser): "LOAD_ASSERT expr CALL_FUNCTION_1 RAISE_VARARGS_1 COME_FROM", ], customize) continue + elif opname == 'LOAD_LISTCOMP': + self.add_unique_rules([ + "expr ::= listcomp", + ], customize) + continue elif opname == 'LOAD_SETCOMP': self.add_unique_rules([ "expr ::= set_comp", diff --git a/uncompyle6/scanners/scanner2.py b/uncompyle6/scanners/scanner2.py index 440a5e3b..a7d7c757 100644 --- a/uncompyle6/scanners/scanner2.py +++ b/uncompyle6/scanners/scanner2.py @@ -260,7 +260,7 @@ class Scanner2(Scanner): customize[op_name] = 0 elif op == self.opc.CONTINUE_LOOP: customize[op_name] = 0 - elif op_name == 'LOAD_SETCOMP': + elif op_name in frozenset(('LOAD_LISTCOMP', 'LOAD_SETCOMP')): customize[op_name] = 0 elif op == self.opc.JUMP_ABSOLUTE: # Further classify JUMP_ABSOLUTE into backward jumps