diff --git a/test/bytecode_3.0/03_pop_top.pyc b/test/bytecode_3.0/03_pop_top.pyc new file mode 100644 index 00000000..04cd89b5 Binary files /dev/null and b/test/bytecode_3.0/03_pop_top.pyc differ diff --git a/test/simple_source/bug30/03_pop_top.py b/test/simple_source/bug30/03_pop_top.py new file mode 100644 index 00000000..cb613ba0 --- /dev/null +++ b/test/simple_source/bug30/03_pop_top.py @@ -0,0 +1,20 @@ +# From 3.0.1 __dummy_thread.py +# bug was handling else: +def interrupt_main(): + """Set _interrupt flag to True to have start_new_thread raise + KeyboardInterrupt upon exiting.""" + if _main: + raise KeyboardInterrupt + else: + global _interrupt + _interrupt = True + +# From 3.0.1 ast.py bug was mangling prototype +# def parse(expr, filename='', mode='exec'): + +# From 3.0.1 bisect +def bisect_left(a, x, lo=0, hi=None): + while lo: + if a[mid] < x: lo = mid+1 + else: hi = mid + return lo diff --git a/uncompyle6/parsers/parse30.py b/uncompyle6/parsers/parse30.py index 4c73f616..ef369566 100644 --- a/uncompyle6/parsers/parse30.py +++ b/uncompyle6/parsers/parse30.py @@ -20,6 +20,8 @@ class Python30Parser(Python31Parser): # In many ways Python 3.0 code generation is more like Python 2.6 than # it is 2.7 or 3.1. So we have a number of 2.6ish (and before) rules below + # Specifically POP_TOP is more prevelant since there is no POP_JUMP_IF_... + # instructions _ifstmts_jump ::= c_stmts_opt JUMP_FORWARD _come_froms POP_TOP COME_FROM @@ -54,6 +56,8 @@ class Python30Parser(Python31Parser): comp_iter ::= expr expr SET_ADD comp_iter ::= expr expr LIST_APPEND + jump_forward_else ::= JUMP_FORWARD POP_TOP + # In many ways 3.0 is like 2.6. The below rules in fact are the same or similar. jmp_true ::= JUMP_IF_TRUE POP_TOP @@ -63,6 +67,8 @@ class Python30Parser(Python31Parser): POP_TOP END_FINALLY come_froms return_if_stmt ::= ret_expr RETURN_END_IF POP_TOP and ::= expr JUMP_IF_FALSE POP_TOP expr COME_FROM + whilestmt ::= SETUP_LOOP testexpr l_stmts_opt + JUMP_BACK POP_TOP POP_BLOCK COME_FROM_LOOP """ def customize_grammar_rules(self, tokens, customize):