mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
GH-125515: Mark code after "return" as unreachable in the cases generator (#133178)
Mark code after "return" as unreachable
This commit is contained in:
parent
42b0b0667e
commit
b329096cfb
2 changed files with 5 additions and 3 deletions
3
Python/generated_cases.c.h
generated
3
Python/generated_cases.c.h
generated
|
@ -7464,9 +7464,6 @@
|
|||
PyObject *result = PyStackRef_AsPyObjectSteal(retval);
|
||||
LLTRACE_RESUME_FRAME();
|
||||
return result;
|
||||
stack_pointer += -1;
|
||||
assert(WITHIN_STACK_BOUNDS());
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(IS_OP) {
|
||||
|
|
|
@ -492,6 +492,11 @@ class Emitter:
|
|||
label_tkn = next(tkn_iter)
|
||||
self.goto_label(tkn, label_tkn, storage)
|
||||
reachable = False
|
||||
elif tkn.kind == "RETURN":
|
||||
self.emit(tkn)
|
||||
semicolon = emit_to(self.out, tkn_iter, "SEMI")
|
||||
self.emit(semicolon)
|
||||
reachable = False
|
||||
elif tkn.kind == "IDENTIFIER":
|
||||
if tkn.text in self._replacers:
|
||||
if not self._replacers[tkn.text](tkn, tkn_iter, uop, storage, inst):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue