summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorBatuhan Taskaya <isidentical@gmail.com>2021-04-25 02:31:20 (GMT)
committerGitHub <noreply@github.com>2021-04-25 02:31:20 (GMT)
commit8cc3cfa8afab1651c4f6e9ba43a7ab7f10f64c32 (patch)
treea6a762b7912545a0825028c9ec8a28186e2f1d13 /Python
parent196983563d05e32d2dcf217e955a919f9e0c25e1 (diff)
downloadcpython-8cc3cfa8afab1651c4f6e9ba43a7ab7f10f64c32.zip
cpython-8cc3cfa8afab1651c4f6e9ba43a7ab7f10f64c32.tar.gz
cpython-8cc3cfa8afab1651c4f6e9ba43a7ab7f10f64c32.tar.bz2
bpo-42737: annotations with complex targets no longer causes any runtime effects (GH-23952)
Diffstat (limited to 'Python')
-rw-r--r--Python/compile.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 1b7a2e8..2cf2f4a 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) {