diff options
author | Jelle Zijlstra <jelle.zijlstra@gmail.com> | 2023-06-05 13:46:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-05 13:46:12 (GMT) |
commit | 48957888d28b0f2b4ae0bf19ffce6bc1e10b94f4 (patch) | |
tree | 797d64466e032f5ce040285462beb93cf462aae1 /Python | |
parent | aca77b5530c34fb2ada0fe02fb83f4c9fa9256f3 (diff) | |
download | cpython-48957888d28b0f2b4ae0bf19ffce6bc1e10b94f4.zip cpython-48957888d28b0f2b4ae0bf19ffce6bc1e10b94f4.tar.gz cpython-48957888d28b0f2b4ae0bf19ffce6bc1e10b94f4.tar.bz2 |
[3.11] gh-105164: Detect annotations inside match blocks (GH-105177). (#105314)
(cherry picked from commit 69d1245685cf95ddc678633e978a56673da64865)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/compile.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c index 1c712fb..5f26da8 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -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; } |