From 8cc3cfa8afab1651c4f6e9ba43a7ab7f10f64c32 Mon Sep 17 00:00:00 2001 From: Batuhan Taskaya Date: Sun, 25 Apr 2021 05:31:20 +0300 Subject: bpo-42737: annotations with complex targets no longer causes any runtime effects (GH-23952) --- Python/compile.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Python/compile.c') diff --git a/Python/compile.c b/Python/compile.c index 1b7a2e83b16..2cf2f4a3824 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5356,6 +5356,12 @@ check_ann_expr(struct compiler *c, expr_ty e) static int check_annotation(struct compiler *c, stmt_ty s) { + /* Annotations of complex targets does not produce anything + under annotations future */ + if (c->c_future->ff_features & CO_FUTURE_ANNOTATIONS) { + return 1; + } + /* Annotations are only evaluated in a module or class. */ if (c->u->u_scope_type == COMPILER_SCOPE_MODULE || c->u->u_scope_type == COMPILER_SCOPE_CLASS) { -- cgit v1.2.3