diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-06-05 13:42:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-05 13:42:31 (GMT) |
commit | 6d0354167f8093183ae5f12205fd0cf991dbbd6a (patch) | |
tree | 49b2b8e58162ee546b3f810f220f0cb698882338 /Python/compile.c | |
parent | 3e7ddc29a3f33b638c5d51d9372763fbc688b06b (diff) | |
download | cpython-6d0354167f8093183ae5f12205fd0cf991dbbd6a.zip cpython-6d0354167f8093183ae5f12205fd0cf991dbbd6a.tar.gz cpython-6d0354167f8093183ae5f12205fd0cf991dbbd6a.tar.bz2 |
[3.12] gh-105164: Detect annotations inside match blocks (GH-105177) (#105313)
(cherry picked from commit 69d1245685cf95ddc678633e978a56673da64865)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Python/compile.c')
-rw-r--r-- | Python/compile.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c index f2314ae..32eda4d 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -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; |