You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Limit pypy exception customization to pypy
This commit is contained in:
@@ -475,24 +475,20 @@ class Python2Parser(PythonParser):
|
|||||||
pass
|
pass
|
||||||
continue
|
continue
|
||||||
elif opname == 'SETUP_EXCEPT':
|
elif opname == 'SETUP_EXCEPT':
|
||||||
# FIXME: have a way here to detect PyPy. Right now we
|
if 'PyPy' in customize:
|
||||||
# only have SETUP_EXCEPT customization for PyPy, but that might not
|
self.add_unique_rules([
|
||||||
# always be the case.
|
"stmt ::= try_except_pypy",
|
||||||
self.add_unique_rules([
|
"try_except_pypy ::= SETUP_EXCEPT suite_stmts_opt except_handler_pypy",
|
||||||
"stmt ::= try_except_pypy",
|
"except_handler_pypy ::= COME_FROM except_stmts END_FINALLY COME_FROM"
|
||||||
"try_except_pypy ::= SETUP_EXCEPT suite_stmts_opt except_handler_pypy",
|
], customize)
|
||||||
"except_handler_pypy ::= COME_FROM except_stmts END_FINALLY COME_FROM"
|
|
||||||
], customize)
|
|
||||||
custom_ops_seen.add(opname)
|
custom_ops_seen.add(opname)
|
||||||
continue
|
continue
|
||||||
elif opname == 'SETUP_FINALLY':
|
elif opname == 'SETUP_FINALLY':
|
||||||
# FIXME: have a way here to detect PyPy. Right now we
|
if 'PyPy' in customize:
|
||||||
# only have SETUP_EXCEPT customization for PyPy, but that might not
|
self.addRule("""
|
||||||
# always be the case.
|
stmt ::= tryfinallystmt_pypy
|
||||||
self.addRule("""
|
tryfinallystmt_pypy ::= SETUP_FINALLY suite_stmts_opt COME_FROM_FINALLY
|
||||||
stmt ::= tryfinallystmt_pypy
|
suite_stmts_opt END_FINALLY""", nop_func)
|
||||||
tryfinallystmt_pypy ::= SETUP_FINALLY suite_stmts_opt COME_FROM_FINALLY
|
|
||||||
suite_stmts_opt END_FINALLY""", nop_func)
|
|
||||||
|
|
||||||
custom_ops_seen.add(opname)
|
custom_ops_seen.add(opname)
|
||||||
continue
|
continue
|
||||||
|
Reference in New Issue
Block a user