summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2023-06-05 13:07:17 (GMT)
committerGitHub <noreply@github.com>2023-06-05 13:07:17 (GMT)
commit69d1245685cf95ddc678633e978a56673da64865 (patch)
tree2d3851bcde83d59a0b47f560380f62080eb8d9ad /Python
parent06893403668961fdbd5d9ece18162eb3470fc8dd (diff)
downloadcpython-69d1245685cf95ddc678633e978a56673da64865.zip
cpython-69d1245685cf95ddc678633e978a56673da64865.tar.gz
cpython-69d1245685cf95ddc678633e978a56673da64865.tar.bz2
gh-105164: Detect annotations inside match blocks (#105177)
Diffstat (limited to 'Python')
-rw-r--r--Python/compile.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 4fa1ee5..d52c2b0 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1398,8 +1398,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;