You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Add 3.8 try else
This commit is contained in:
BIN
test/bytecode_3.8/04_async_stmt.pyc
Normal file
BIN
test/bytecode_3.8/04_async_stmt.pyc
Normal file
Binary file not shown.
@@ -32,6 +32,7 @@ class Python38Parser(Python37Parser):
|
||||
stmt ::= forelselaststmt38
|
||||
stmt ::= forelselaststmtl38
|
||||
stmt ::= tryfinally38
|
||||
stmt ::= try_elsestmtl38
|
||||
stmt ::= try_except_ret38
|
||||
stmt ::= try_except38
|
||||
stmt ::= whilestmt38
|
||||
@@ -112,6 +113,10 @@ class Python38Parser(Python37Parser):
|
||||
except_cond1 ::= DUP_TOP expr COMPARE_OP jmp_false
|
||||
POP_TOP POP_TOP POP_TOP
|
||||
POP_EXCEPT
|
||||
|
||||
try_elsestmtl38 ::= SETUP_FINALLY suite_stmts_opt POP_BLOCK
|
||||
except_handler38 COME_FROM
|
||||
else_suitel opt_come_from_except
|
||||
try_except ::= SETUP_FINALLY suite_stmts_opt POP_BLOCK
|
||||
except_handler38
|
||||
try_except38 ::= SETUP_FINALLY POP_BLOCK POP_TOP suite_stmts_opt
|
||||
@@ -201,6 +206,10 @@ class Python38Parser(Python37Parser):
|
||||
forelsestmt ::= SETUP_LOOP expr for_iter store for_block POP_BLOCK else_suite
|
||||
forelselaststmt ::= SETUP_LOOP expr for_iter store for_block POP_BLOCK else_suitec
|
||||
forelselaststmtl ::= SETUP_LOOP expr for_iter store for_block POP_BLOCK else_suitel
|
||||
|
||||
tryelsestmtl3 ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK
|
||||
except_handler COME_FROM else_suitel
|
||||
opt_come_from_except
|
||||
try_except ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK
|
||||
except_handler opt_come_from_except
|
||||
tryfinallystmt ::= SETUP_FINALLY suite_stmts_opt POP_BLOCK
|
||||
|
@@ -999,15 +999,20 @@ def customize_for_version3(self, version):
|
||||
(0, 'testexpr'), (1, 'l_stmts') ),
|
||||
'whileTruestmt38': ( '%|while True:\n%+%c%-\n\n',
|
||||
(0, 'l_stmts') ),
|
||||
'tryfinally38': (
|
||||
'%|try:\n%+%c%-%|finally:\n%+%c%-\n\n',
|
||||
(3, 'returns'), 6 ),
|
||||
'try_elsestmtl38': (
|
||||
'%|try:\n%+%c%-%c%|else:\n%+%c%-',
|
||||
(1, 'suite_stmts_opt'),
|
||||
(3, 'except_handler38'),
|
||||
(5, 'else_suitel') ),
|
||||
'try_except38': (
|
||||
'%|try:\n%+%c\n%-%|except:\n%|%-%c\n\n',
|
||||
(-2, 'suite_stmts_opt'), (-1, 'except_handler38a') ),
|
||||
'try_except_ret38': (
|
||||
'%|try:\n%+%|return %c%-\n%|except:\n%+%|%c%-\n\n',
|
||||
(1, 'expr'), (-1, 'except_ret38a') ),
|
||||
'tryfinally38': (
|
||||
'%|try:\n%+%c%-%|finally:\n%+%c%-\n\n',
|
||||
(3, 'returns'), 6 ),
|
||||
})
|
||||
pass # version >= 3.8
|
||||
pass
|
||||
|
Reference in New Issue
Block a user