diff --git a/test/bytecode_2.6/02_true_divide.pyc b/test/bytecode_2.6/02_true_divide.pyc index dde95bb8..54ed07ee 100644 Binary files a/test/bytecode_2.6/02_true_divide.pyc and b/test/bytecode_2.6/02_true_divide.pyc differ diff --git a/test/bytecode_2.7/02_true_divide.pyc b/test/bytecode_2.7/02_true_divide.pyc index 5ffecbdc..60e63eea 100644 Binary files a/test/bytecode_2.7/02_true_divide.pyc and b/test/bytecode_2.7/02_true_divide.pyc differ diff --git a/test/simple_source/expression/02_true_divide.py b/test/simple_source/expression/02_true_divide.py index fb866d4b..5a9ea426 100644 --- a/test/simple_source/expression/02_true_divide.py +++ b/test/simple_source/expression/02_true_divide.py @@ -1,3 +1,4 @@ -# Tests BINARY_TRUE_DIVIDE +# Tests BINARY_TRUE_DIVIDE and INPLACE_TRUE_DIVIDE from __future__ import division # needed on 2.6 and 2.7 x = len(__file__) / 1 +x /= 1 diff --git a/uncompyle6/parsers/parse2.py b/uncompyle6/parsers/parse2.py index 52750f9d..f9f6a25d 100644 --- a/uncompyle6/parsers/parse2.py +++ b/uncompyle6/parsers/parse2.py @@ -40,10 +40,6 @@ class Python2Parser(PythonParser): def p_stmt2(self, args): """ - # Note: these are removed in 2.7 - while1stmt ::= SETUP_LOOP l_stmts JUMP_BACK COME_FROM - while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK else_suite COME_FROM - exec_stmt ::= expr exprlist DUP_TOP EXEC_STMT exec_stmt ::= expr exprlist EXEC_STMT diff --git a/uncompyle6/parsers/parse25.py b/uncompyle6/parsers/parse25.py index 9c539c29..9e013712 100644 --- a/uncompyle6/parsers/parse25.py +++ b/uncompyle6/parsers/parse25.py @@ -53,7 +53,6 @@ class Python25Parser(Python26Parser): POP_BLOCK LOAD_CONST COME_FROM WITH_CLEANUP END_FINALLY withasstmt ::= expr setupwithas designator suite_stmts_opt POP_BLOCK LOAD_CONST COME_FROM WITH_CLEANUP END_FINALLY - whilestmt ::= SETUP_LOOP testexpr return_stmts come_froms POP_TOP bp_come_from assert2 ::= assert_expr jmp_true LOAD_ASSERT expr CALL_FUNCTION_1 RAISE_VARARGS_1 """) super(Python25Parser, self).add_custom_rules(tokens, customize) diff --git a/uncompyle6/parsers/parse26.py b/uncompyle6/parsers/parse26.py index 0283a6a8..70e77f48 100644 --- a/uncompyle6/parsers/parse26.py +++ b/uncompyle6/parsers/parse26.py @@ -126,27 +126,27 @@ class Python26Parser(Python2Parser): POP_BLOCK LOAD_CONST COME_FROM WITH_CLEANUP END_FINALLY # Semantic actions want designator to be at index 2 - # Rule is possibly 2.6 only withasstmt ::= expr setupwithas designator suite_stmts_opt POP_BLOCK LOAD_CONST COME_FROM WITH_CLEANUP END_FINALLY # This is truly weird. 2.7 does this (not including POP_TOP) with # opcode SETUP_WITH - setupwith ::= DUP_TOP LOAD_ATTR ROT_TWO LOAD_ATTR CALL_FUNCTION_0 POP_TOP - # Possibly 2.6 only - setupwithas ::= DUP_TOP LOAD_ATTR ROT_TWO LOAD_ATTR CALL_FUNCTION_0 setup_finally + setupwith ::= DUP_TOP LOAD_ATTR ROT_TWO LOAD_ATTR CALL_FUNCTION_0 POP_TOP + setupwithas ::= DUP_TOP LOAD_ATTR ROT_TWO LOAD_ATTR CALL_FUNCTION_0 setup_finally setup_finally ::= STORE_FAST SETUP_FINALLY LOAD_FAST DELETE_FAST setup_finally ::= STORE_NAME SETUP_FINALLY LOAD_NAME DELETE_NAME + while1stmt ::= SETUP_LOOP l_stmts JUMP_BACK COME_FROM - whilestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_pop POP_BLOCK _come_from - whilestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_cf_pop bp_come_from - whilestmt ::= SETUP_LOOP testexpr return_stmts come_froms POP_TOP bp_come_from + whilestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_pop POP_BLOCK _come_from + whilestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_cf_pop bp_come_from + whilestmt ::= SETUP_LOOP testexpr return_stmts come_froms POP_TOP bp_come_from - whileelsestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_pop POP_BLOCK - else_suite COME_FROM + whileelsestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_pop POP_BLOCK + else_suite COME_FROM + while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK else_suite COME_FROM return_stmt ::= ret_expr RETURN_END_IF POP_TOP return_stmt ::= ret_expr RETURN_VALUE POP_TOP diff --git a/uncompyle6/parsers/parse27.py b/uncompyle6/parsers/parse27.py index 81b62acd..f672ec64 100644 --- a/uncompyle6/parsers/parse27.py +++ b/uncompyle6/parsers/parse27.py @@ -105,6 +105,7 @@ class Python27Parser(Python2Parser): while1stmt ::= SETUP_LOOP return_stmts bp_come_from while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK POP_BLOCK else_suite COME_FROM while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_BLOCK COME_FROM + whilestmt ::= SETUP_LOOP testexpr l_stmts_opt JUMP_BACK POP_BLOCK _come_from # Common with 2.6 return_if_lambda ::= RETURN_END_IF_LAMBDA COME_FROM