You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
Trystmt grammar from 3.3 needed in 3.2
Add test to cover this
This commit is contained in:
BIN
test/bytecode_3.2/03_if_try_raise.pyc
Normal file
BIN
test/bytecode_3.2/03_if_try_raise.pyc
Normal file
Binary file not shown.
21
test/simple_source/bug32/03_if_try_raise.py
Normal file
21
test/simple_source/bug32/03_if_try_raise.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# From 3.2 distutils/core
|
||||
# Ensure we handle funky trystmt
|
||||
def setup (ok, dist, **attrs):
|
||||
if ok:
|
||||
try:
|
||||
dist.run_commands()
|
||||
except KeyboardInterrupt:
|
||||
raise SystemExit("interrupted")
|
||||
except IOError as exc:
|
||||
error = exc
|
||||
if dist:
|
||||
raise
|
||||
else:
|
||||
raise SystemExit(error)
|
||||
except (RuntimeError) as msg:
|
||||
if dist:
|
||||
raise
|
||||
else:
|
||||
raise SystemExit("error: " + str(msg))
|
||||
|
||||
return dist
|
@@ -21,6 +21,13 @@ class Python32Parser(Python3Parser):
|
||||
whileTruestmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK COME_FROM_LOOP
|
||||
whileTruestmt ::= SETUP_LOOP return_stmts COME_FROM_LOOP
|
||||
|
||||
# Python 3.5+ has jump optimization to remove the redundant
|
||||
# jump_excepts. But in 3.3 we need them added
|
||||
|
||||
trystmt ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK
|
||||
try_middle
|
||||
jump_excepts come_from_except_clauses
|
||||
|
||||
try_middle ::= JUMP_FORWARD COME_FROM_EXCEPT except_stmts
|
||||
END_FINALLY
|
||||
|
||||
|
Reference in New Issue
Block a user