[3.11] gh-105164: Detect annotations inside match blocks (GH-105177). (#105314)

(cherry picked from commit 69d1245685)
This commit is contained in:
Jelle Zijlstra 2023-06-05 06:46:12 -07:00 committed by GitHub
parent aca77b5530
commit 48957888d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 122 additions and 0 deletions

View file

@ -1905,6 +1905,15 @@ 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 = 0;
}