mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
[3.11] gh-105164: Detect annotations inside match blocks (GH-105177). (#105314)
(cherry picked from commit 69d1245685
)
This commit is contained in:
parent
aca77b5530
commit
48957888d2
3 changed files with 122 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue