diff --git a/test/bytecode_3.0/03_ifelse.pyc b/test/bytecode_3.0/03_ifelse.pyc index daa754a5..b619b719 100644 Binary files a/test/bytecode_3.0/03_ifelse.pyc and b/test/bytecode_3.0/03_ifelse.pyc differ diff --git a/test/simple_source/bug30/03_ifelse.py b/test/simple_source/bug30/03_ifelse.py index 1af08601..4d80ed4e 100644 --- a/test/simple_source/bug30/03_ifelse.py +++ b/test/simple_source/bug30/03_ifelse.py @@ -18,3 +18,13 @@ def parse_marked_section(fn, i, rawdata, report=1): j = 1 fn(rawdata[i: j]) return 10 + +# From 3.0.1 _abcoll.py +# Bug was in genexpr_func which doesn't have a JUMP_BACK but +# in its gen_comp_body, we can use COME_FROM in its place. +# As above omission of JUMPs is a feature of 3.0 that doesn't +# seem to be in later versions (or earlier like 2.6). +def __and__(self, other): + if not isinstance(other, Iterable): + return NotImplemented + return self._from_iterable(value for value in other if value in self) diff --git a/uncompyle6/parsers/parse30.py b/uncompyle6/parsers/parse30.py index c9288e5d..f5e07b95 100644 --- a/uncompyle6/parsers/parse30.py +++ b/uncompyle6/parsers/parse30.py @@ -119,8 +119,9 @@ class Python30Parser(Python31Parser): call_stmt ::= expr COME_FROM _ifstmts_jump30 ::= c_stmts POP_TOP - ################################################################################ + gen_comp_body ::= expr YIELD_VALUE COME_FROM POP_TOP + ################################################################################ for_block ::= l_stmts_opt _come_froms POP_TOP JUMP_BACK except_handler ::= JUMP_FORWARD COME_FROM_EXCEPT except_stmts