mirror of
https://github.com/python/cpython.git
synced 2025-09-01 14:38:00 +00:00
bpo-42737: annotations with complex targets no longer causes any runtime effects (GH-23952)
This commit is contained in:
parent
196983563d
commit
8cc3cfa8af
4 changed files with 23 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue