Limit pypy exception customization to pypy

This commit is contained in:
rocky
2018-01-07 11:20:01 -05:00
parent 6aa4376fca
commit 7db8001d54

View File

@@ -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