From d8b3a98c9098c66a714fd5593e1928af0ffbc631 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Tue, 5 Mar 2019 20:42:06 +0200 Subject: 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. --- Python/symtable.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'Python/symtable.c') 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); -- cgit v1.2.1