mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
GH-128073: Include EXIT_IF when checking for escaping calls (GH-128537)
This commit is contained in:
parent
f89e5e20cb
commit
b9c693dcca
2 changed files with 26 additions and 1 deletions
|
|
@ -1713,6 +1713,31 @@ def test_pop_dead_inputs_with_output(self):
|
|||
"""
|
||||
self.run_cases_test(input, output)
|
||||
|
||||
def test_no_escaping_calls_in_branching_macros(self):
|
||||
|
||||
input = """
|
||||
inst(OP, ( -- )) {
|
||||
DEOPT_IF(escaping_call());
|
||||
}
|
||||
"""
|
||||
with self.assertRaises(SyntaxError):
|
||||
self.run_cases_test(input, "")
|
||||
|
||||
input = """
|
||||
inst(OP, ( -- )) {
|
||||
EXIT_IF(escaping_call());
|
||||
}
|
||||
"""
|
||||
with self.assertRaises(SyntaxError):
|
||||
self.run_cases_test(input, "")
|
||||
|
||||
input = """
|
||||
inst(OP, ( -- )) {
|
||||
ERROR_IF(escaping_call(), error);
|
||||
}
|
||||
"""
|
||||
with self.assertRaises(SyntaxError):
|
||||
self.run_cases_test(input, "")
|
||||
|
||||
class TestGeneratedAbstractCases(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
|
|
|
|||
|
|
@ -668,7 +668,7 @@ def check_escaping_calls(instr: parser.InstDef, escapes: dict[lexer.Token, tuple
|
|||
if tkn.kind == "IF":
|
||||
next(tkn_iter)
|
||||
in_if = 1
|
||||
if tkn.kind == "IDENTIFIER" and tkn.text in ("DEOPT_IF", "ERROR_IF"):
|
||||
if tkn.kind == "IDENTIFIER" and tkn.text in ("DEOPT_IF", "ERROR_IF", "EXIT_IF"):
|
||||
next(tkn_iter)
|
||||
in_if = 1
|
||||
elif tkn.kind == "LPAREN" and in_if:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue