diff --git a/test/bytecode_2.6/06_return_if.pyc b/test/bytecode_2.6/06_return_if.pyc new file mode 100644 index 00000000..3564f028 Binary files /dev/null and b/test/bytecode_2.6/06_return_if.pyc differ diff --git a/test/simple_source/stmts/06_return_if.py b/test/simple_source/stmts/06_return_if.py new file mode 100644 index 00000000..6d418479 --- /dev/null +++ b/test/simple_source/stmts/06_return_if.py @@ -0,0 +1,11 @@ +# from 2.6.9 Bastion.py +# Should see in 2.6.9: +# return_if_stmt ::= ret_expr RETURN_END_IF come_from_pop + +def Bastion(object, filter = lambda name: name[:1] != '_'): + def get1(name, attribute, MethodType, object=object, filter=filter): + if filter(name): + attribute = getattr(object, name) + if type(attribute) == MethodType: + return attribute + raise AttributeError, name diff --git a/uncompyle6/parsers/parse26.py b/uncompyle6/parsers/parse26.py index 123bc5a5..155d1983 100644 --- a/uncompyle6/parsers/parse26.py +++ b/uncompyle6/parsers/parse26.py @@ -57,15 +57,6 @@ class Python26Parser(Python2Parser): """ - def p_whilestmt(self, args): - """ - whilestmt ::= SETUP_LOOP - testexpr - l_stmts_opt jb_pop - POP_BLOCK _come_from - - """ - def p_misc26(self, args): """ jmp_true ::= JUMP_IF_TRUE POP_TOP @@ -94,6 +85,14 @@ class Python26Parser(Python2Parser): # 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 + + whilestmt ::= SETUP_LOOP + testexpr + l_stmts_opt jb_pop + POP_BLOCK _come_from + + return_if_stmt ::= ret_expr RETURN_END_IF come_from_pop + """ def p_comp26(self, args):