diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-03-05 20:42:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-05 20:42:06 +0200 |
commit | d8b3a98c9098c66a714fd5593e1928af0ffbc631 (patch) | |
tree | dc9c2290f796ec697adcfa12942f773646f8f13c /Python/symtable.c | |
parent | adfffc7343ce7ebc88ec734a803d3247ba8927fb (diff) | |
download | cpython-git-d8b3a98c9098c66a714fd5593e1928af0ffbc631.tar.gz |
bpo-36187: Remove NamedStore. (GH-12167)
NamedStore has been replaced with Store. The difference between
NamedStore and Store is handled when precess the NamedExpr node
one level upper.
Diffstat (limited to 'Python/symtable.c')
-rw-r--r-- | Python/symtable.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Python/symtable.c b/Python/symtable.c index 6e2df2f3c9..1d68a7d939 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -1452,6 +1452,10 @@ symtable_visit_expr(struct symtable *st, expr_ty e) } switch (e->kind) { case NamedExpr_kind: + if (st->st_cur->ste_comprehension) { + if (!symtable_extend_namedexpr_scope(st, e->v.NamedExpr.target)) + VISIT_QUIT(st, 0); + } VISIT(st, expr, e->v.NamedExpr.value); VISIT(st, expr, e->v.NamedExpr.target); break; @@ -1555,11 +1559,6 @@ symtable_visit_expr(struct symtable *st, expr_ty e) VISIT(st, expr, e->v.Starred.value); break; case Name_kind: - /* Special-case: named expr */ - if (e->v.Name.ctx == NamedStore && st->st_cur->ste_comprehension) { - if(!symtable_extend_namedexpr_scope(st, e)) - VISIT_QUIT(st, 0); - } if (!symtable_add_def(st, e->v.Name.id, e->v.Name.ctx == Load ? USE : DEF_LOCAL)) VISIT_QUIT(st, 0); |