You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Fixes #174
This commit is contained in:
BIN
test/bytecode_2.7/03_for_try_raise.pyc
Normal file
BIN
test/bytecode_2.7/03_for_try_raise.pyc
Normal file
Binary file not shown.
12
test/simple_source/bug27+/03_for_try_raise.py
Normal file
12
test/simple_source/bug27+/03_for_try_raise.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# Code in 2.7 needing rule:
|
||||||
|
# try_except ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK except_handler
|
||||||
|
# Generally we need a COME_FROM. But not in the situation below.
|
||||||
|
|
||||||
|
for package in [1,2]:
|
||||||
|
try:
|
||||||
|
pass
|
||||||
|
except IndexError:
|
||||||
|
with __file__ as f:
|
||||||
|
pass
|
||||||
|
except:
|
||||||
|
raise
|
@@ -51,6 +51,10 @@ class Python27Parser(Python2Parser):
|
|||||||
|
|
||||||
def p_try27(self, args):
|
def p_try27(self, args):
|
||||||
"""
|
"""
|
||||||
|
# If the last except is a "raise" we might not have a final COME_FROM
|
||||||
|
try_except ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK
|
||||||
|
except_handler
|
||||||
|
|
||||||
tryfinallystmt ::= SETUP_FINALLY suite_stmts_opt
|
tryfinallystmt ::= SETUP_FINALLY suite_stmts_opt
|
||||||
POP_BLOCK LOAD_CONST
|
POP_BLOCK LOAD_CONST
|
||||||
COME_FROM_FINALLY suite_stmts_opt END_FINALLY
|
COME_FROM_FINALLY suite_stmts_opt END_FINALLY
|
||||||
@@ -144,6 +148,8 @@ class Python27Parser(Python2Parser):
|
|||||||
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK COME_FROM
|
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK COME_FROM
|
||||||
while1stmt ::= SETUP_LOOP l_stmts_opt CONTINUE COME_FROM
|
while1stmt ::= SETUP_LOOP l_stmts_opt CONTINUE COME_FROM
|
||||||
while1stmt ::= SETUP_LOOP returns COME_FROM
|
while1stmt ::= SETUP_LOOP returns COME_FROM
|
||||||
|
while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK
|
||||||
|
else_suitel COME_FROM
|
||||||
|
|
||||||
while1stmt ::= SETUP_LOOP returns bp_come_from
|
while1stmt ::= SETUP_LOOP returns bp_come_from
|
||||||
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_BLOCK COME_FROM
|
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_BLOCK COME_FROM
|
||||||
|
Reference in New Issue
Block a user