Skip to content

Commit b9c693d

Browse files
authored
GH-128073: Include EXIT_IF when checking for escaping calls (GH-128537)
1 parent f89e5e2 commit b9c693d

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

Lib/test/test_generated_cases.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,6 +1713,31 @@ def test_pop_dead_inputs_with_output(self):
17131713
"""
17141714
self.run_cases_test(input, output)
17151715

1716+
def test_no_escaping_calls_in_branching_macros(self):
1717+
1718+
input = """
1719+
inst(OP, ( -- )) {
1720+
DEOPT_IF(escaping_call());
1721+
}
1722+
"""
1723+
with self.assertRaises(SyntaxError):
1724+
self.run_cases_test(input, "")
1725+
1726+
input = """
1727+
inst(OP, ( -- )) {
1728+
EXIT_IF(escaping_call());
1729+
}
1730+
"""
1731+
with self.assertRaises(SyntaxError):
1732+
self.run_cases_test(input, "")
1733+
1734+
input = """
1735+
inst(OP, ( -- )) {
1736+
ERROR_IF(escaping_call(), error);
1737+
}
1738+
"""
1739+
with self.assertRaises(SyntaxError):
1740+
self.run_cases_test(input, "")
17161741

17171742
class TestGeneratedAbstractCases(unittest.TestCase):
17181743
def setUp(self) -> None:

Tools/cases_generator/analyzer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ def check_escaping_calls(instr: parser.InstDef, escapes: dict[lexer.Token, tuple
668668
if tkn.kind == "IF":
669669
next(tkn_iter)
670670
in_if = 1
671-
if tkn.kind == "IDENTIFIER" and tkn.text in ("DEOPT_IF", "ERROR_IF"):
671+
if tkn.kind == "IDENTIFIER" and tkn.text in ("DEOPT_IF", "ERROR_IF", "EXIT_IF"):
672672
next(tkn_iter)
673673
in_if = 1
674674
elif tkn.kind == "LPAREN" and in_if:

0 commit comments

Comments
 (0)