You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Handle Python 3.1 "with ... as" statement
This commit is contained in:
BIN
test/bytecode_3.1/04_withas.pyc
Normal file
BIN
test/bytecode_3.1/04_withas.pyc
Normal file
Binary file not shown.
@@ -698,10 +698,22 @@ 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
|
||||
setupwithas ::= DUP_TOP LOAD_ATTR store LOAD_ATTR CALL_FUNCTION_0 store
|
||||
withstmt ::= expr setupwith SETUP_FINALLY
|
||||
suite_stmts_opt
|
||||
POP_BLOCK LOAD_CONST COME_FROM_FINALLY
|
||||
load del_stmt WITH_CLEANUP END_FINALLY
|
||||
|
||||
# Keeps Python 3.1 withas desigator in the same position as it is in other version
|
||||
setupwithas31 ::= setupwithas SETUP_FINALLY load del_stmt
|
||||
|
||||
withasstmt ::= expr setupwithas31 designator
|
||||
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
|
||||
|
Reference in New Issue
Block a user