You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Fix bug in return-optimized try stmt
This commit is contained in:
BIN
test/bytecode_3.6/04_importlist.pyc
Normal file
BIN
test/bytecode_3.6/04_importlist.pyc
Normal file
Binary file not shown.
@@ -63,6 +63,12 @@ class Python36Parser(Python35Parser):
|
||||
|
||||
except_return ::= POP_TOP POP_TOP POP_TOP return_stmts
|
||||
try_middle ::= JUMP_FORWARD COME_FROM_EXCEPT except_return
|
||||
|
||||
# Try middle following a return_stmts
|
||||
try_middle36 ::= COME_FROM_EXCEPT except_stmts END_FINALLY
|
||||
|
||||
stmt ::= trystmt36
|
||||
trystmt36 ::= SETUP_EXCEPT return_stmts try_middle36 opt_come_from_except
|
||||
"""
|
||||
|
||||
def add_custom_rules(self, tokens, customize):
|
||||
|
@@ -418,6 +418,11 @@ class SourceWalker(GenericASTTraversal, object):
|
||||
# 'unmapexpr': ( '{**%c}', 0), # done by n_unmapexpr
|
||||
|
||||
})
|
||||
if version >= 3.6:
|
||||
TABLE_DIRECT.update({
|
||||
'trystmt36': ( '%|try:\n%+%c%-%c\n\n', 1, 2 ),
|
||||
})
|
||||
|
||||
def n_async_call_function(node):
|
||||
self.f.write('async ')
|
||||
node.kind == 'call_function'
|
||||
|
Reference in New Issue
Block a user