mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
[3.11] GH-103971: Fix incorrect locations for code following case blocks
This commit is contained in:
parent
4219074127
commit
fee3c91a19
3 changed files with 16 additions and 0 deletions
|
@ -7057,6 +7057,7 @@ compiler_match_inner(struct compiler *c, stmt_ty s, pattern_context *pc)
|
|||
ADDOP(c, POP_TOP);
|
||||
}
|
||||
VISIT_SEQ(c, stmt, m->body);
|
||||
UNSET_LOC(c);
|
||||
ADDOP_JUMP(c, JUMP, end);
|
||||
// If the pattern fails to match, we want the line number of the
|
||||
// cleanup to be associated with the failed pattern, not the last line
|
||||
|
@ -7081,6 +7082,7 @@ compiler_match_inner(struct compiler *c, stmt_ty s, pattern_context *pc)
|
|||
RETURN_IF_FALSE(compiler_jump_if(c, m->guard, end, 0));
|
||||
}
|
||||
VISIT_SEQ(c, stmt, m->body);
|
||||
UNSET_LOC(c);
|
||||
}
|
||||
compiler_use_next_block(c, end);
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue