Skip to content

Commit 04c7f36

Browse files
authored
gh-138230: Remove dead code in code gen - codegen_check_annotation is only calle… (#138228)
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 766e7f1 commit 04c7f36

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
@@ -5414,23 +5414,6 @@ codegen_check_ann_expr(compiler *c, expr_ty e)
54145414
return SUCCESS;
54155415
}
54165416

5417-
static int
5418-
codegen_check_annotation(compiler *c, stmt_ty s)
5419-
{
5420-
/* Annotations of complex targets does not produce anything
5421-
under annotations future */
5422-
if (FUTURE_FEATURES(c) & CO_FUTURE_ANNOTATIONS) {
5423-
return SUCCESS;
5424-
}
5425-
5426-
/* Annotations are only evaluated in a module or class. */
5427-
if (SCOPE_TYPE(c) == COMPILE_SCOPE_MODULE ||
5428-
SCOPE_TYPE(c) == COMPILE_SCOPE_CLASS) {
5429-
return codegen_check_ann_expr(c, s->v.AnnAssign.annotation);
5430-
}
5431-
return SUCCESS;
5432-
}
5433-
54345417
static int
54355418
codegen_check_ann_subscr(compiler *c, expr_ty e)
54365419
{
@@ -5524,10 +5507,6 @@ codegen_annassign(compiler *c, stmt_ty s)
55245507
targ->kind);
55255508
return ERROR;
55265509
}
5527-
/* Annotation is evaluated last. */
5528-
if (future_annotations && !s->v.AnnAssign.simple && codegen_check_annotation(c, s) < 0) {
5529-
return ERROR;
5530-
}
55315510
return SUCCESS;
55325511
}
55335512

0 commit comments

Comments
 (0)