Skip to content

Commit 64bf861

Browse files
committed
Remove dead code in code gen - codegen_check_annotation is only called if future annotations are enabled, and if future annotations are enabled it does nothing.
1 parent c779f23 commit 64bf861

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

Python/codegen.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5412,23 +5412,6 @@ codegen_check_ann_expr(compiler *c, expr_ty e)
54125412
return SUCCESS;
54135413
}
54145414

5415-
static int
5416-
codegen_check_annotation(compiler *c, stmt_ty s)
5417-
{
5418-
/* Annotations of complex targets does not produce anything
5419-
under annotations future */
5420-
if (FUTURE_FEATURES(c) & CO_FUTURE_ANNOTATIONS) {
5421-
return SUCCESS;
5422-
}
5423-
5424-
/* Annotations are only evaluated in a module or class. */
5425-
if (SCOPE_TYPE(c) == COMPILE_SCOPE_MODULE ||
5426-
SCOPE_TYPE(c) == COMPILE_SCOPE_CLASS) {
5427-
return codegen_check_ann_expr(c, s->v.AnnAssign.annotation);
5428-
}
5429-
return SUCCESS;
5430-
}
5431-
54325415
static int
54335416
codegen_check_ann_subscr(compiler *c, expr_ty e)
54345417
{
@@ -5522,10 +5505,6 @@ codegen_annassign(compiler *c, stmt_ty s)
55225505
targ->kind);
55235506
return ERROR;
55245507
}
5525-
/* Annotation is evaluated last. */
5526-
if (future_annotations && !s->v.AnnAssign.simple && codegen_check_annotation(c, s) < 0) {
5527-
return ERROR;
5528-
}
55295508
return SUCCESS;
55305509
}
55315510

0 commit comments

Comments
 (0)