diff --git a/test/bytecode_3.1/07_withstmt_fn.pyc b/test/bytecode_3.1/07_withstmt_fn.pyc new file mode 100644 index 00000000..f8e08863 Binary files /dev/null and b/test/bytecode_3.1/07_withstmt_fn.pyc differ diff --git a/test/simple_source/stmts/07_withstmt_fn.py b/test/simple_source/stmts/07_withstmt_fn.py index 03a26247..dee5a7a0 100644 --- a/test/simple_source/stmts/07_withstmt_fn.py +++ b/test/simple_source/stmts/07_withstmt_fn.py @@ -1,4 +1,4 @@ -# Python 2.6 has a truly weird way of handling with here. +# Python 2.6 has a truly weird way of handling "with" here. # added rule for 2.6 # setupwith ::= DUP_TOP LOAD_ATTR ROT_TWO LOAD_ATTR CALL_FUNCTION_0 POP_TOP diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index 0356a99e..f868d2ca 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -698,6 +698,14 @@ class Python31Parser(Python32Parser): def p_31(self, args): """ binary_subscr2 ::= expr expr DUP_TOPX BINARY_SUBSCR + setupwith ::= DUP_TOP LOAD_ATTR store LOAD_ATTR CALL_FUNCTION_0 POP_TOP + withstmt ::= expr setupwith SETUP_FINALLY suite_stmts_opt + POP_BLOCK LOAD_CONST COME_FROM_FINALLY + load del_stmt WITH_CLEANUP END_FINALLY + store ::= STORE_FAST + store ::= STORE_NAME + load ::= LOAD_FAST + load ::= LOAD_NAME """ class Python3ParserSingle(Python3Parser, PythonParserSingle):