diff --git a/test/bytecode_3.0/03_ifelse.pyc b/test/bytecode_3.0/03_ifelse.pyc index b619b719..fa86044c 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 4d80ed4e..fcb813fd 100644 --- a/test/simple_source/bug30/03_ifelse.py +++ b/test/simple_source/bug30/03_ifelse.py @@ -1,7 +1,7 @@ # Adapted from 3.0 base64 # Problem was handling if/else which # needs to be like Python 2.6 (and not like 2.7 or 3.1) -def main(args, f): +def main(args, f, func, sys): """Small main program""" if args and args[0] != '-': func(f, sys.stdout.buffer) @@ -24,7 +24,14 @@ def parse_marked_section(fn, i, rawdata, report=1): # 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): +def __and__(self, other, Iterable): if not isinstance(other, Iterable): return NotImplemented return self._from_iterable(value for value in other if value in self) + +# Adapted from 3.0.1 abc.py +# Bug was in handling multiple COME_FROMs in return_if_stmt +def __instancecheck__(subtype, subclass, cls): + if subtype: + if (cls and subclass): + return False diff --git a/uncompyle6/parsers/parse30.py b/uncompyle6/parsers/parse30.py index f8de3014..00c79605 100644 --- a/uncompyle6/parsers/parse30.py +++ b/uncompyle6/parsers/parse30.py @@ -136,7 +136,7 @@ class Python30Parser(Python31Parser): except_handler ::= jmp_abs COME_FROM_EXCEPT except_stmts POP_TOP END_FINALLY - return_if_stmt ::= ret_expr RETURN_END_IF COME_FROM POP_TOP + return_if_stmt ::= ret_expr RETURN_END_IF come_froms POP_TOP and ::= expr jmp_false expr come_from_opt whilestmt ::= SETUP_LOOP testexpr l_stmts_opt come_from_opt JUMP_BACK come_froms POP_TOP POP_BLOCK COME_FROM_LOOP