mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
[3.12] gh-105164: Detect annotations inside match blocks (GH-105177) (#105313)
(cherry picked from commit 69d1245685
)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
parent
3e7ddc29a3
commit
6d0354167f
3 changed files with 123 additions and 0 deletions
|
@ -1422,8 +1422,18 @@ find_ann(asdl_stmt_seq *stmts)
|
|||
find_ann(st->v.TryStar.finalbody) ||
|
||||
find_ann(st->v.TryStar.orelse);
|
||||
break;
|
||||
case Match_kind:
|
||||
for (j = 0; j < asdl_seq_LEN(st->v.Match.cases); j++) {
|
||||
match_case_ty match_case = (match_case_ty)asdl_seq_GET(
|
||||
st->v.Match.cases, j);
|
||||
if (find_ann(match_case->body)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
res = false;
|
||||
break;
|
||||
}
|
||||
if (res) {
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue