[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:
Miss Islington (bot) 2023-06-05 06:42:31 -07:00 committed by GitHub
parent 3e7ddc29a3
commit 6d0354167f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 123 additions and 0 deletions

View file

@ -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;