Skip to content

Commit b329096

Browse files
authored
GH-125515: Mark code after "return" as unreachable in the cases generator (#133178)
Mark code after "return" as unreachable
1 parent 42b0b06 commit b329096

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Python/generated_cases.c.h

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tools/cases_generator/generators_common.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,11 @@ def emit_SimpleStmt(
492492
label_tkn = next(tkn_iter)
493493
self.goto_label(tkn, label_tkn, storage)
494494
reachable = False
495+
elif tkn.kind == "RETURN":
496+
self.emit(tkn)
497+
semicolon = emit_to(self.out, tkn_iter, "SEMI")
498+
self.emit(semicolon)
499+
reachable = False
495500
elif tkn.kind == "IDENTIFIER":
496501
if tkn.text in self._replacers:
497502
if not self._replacers[tkn.text](tkn, tkn_iter, uop, storage, inst):

0 commit comments

Comments
 (0)