diff options
author | Benjamin Peterson <benjamin@python.org> | 2011-05-27 18:58:08 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2011-05-27 18:58:08 (GMT) |
commit | bf1bbc145299964a37cfae5bc5565177192f68ad (patch) | |
tree | ce4eccef9452efe19126ae83e22d006a300328c0 /Python/symtable.c | |
parent | 05010706697ce9c18e7f8a8e571753b0bcfd6548 (diff) | |
download | cpython-bf1bbc145299964a37cfae5bc5565177192f68ad.zip cpython-bf1bbc145299964a37cfae5bc5565177192f68ad.tar.gz cpython-bf1bbc145299964a37cfae5bc5565177192f68ad.tar.bz2 |
reflect with statements with multiple items in the AST (closes #12106)
Diffstat (limited to 'Python/symtable.c')
-rw-r--r-- | Python/symtable.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Python/symtable.c b/Python/symtable.c index 8040665..d276254 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -185,6 +185,7 @@ static int symtable_visit_params(struct symtable *st, asdl_seq *args); static int symtable_visit_argannotations(struct symtable *st, asdl_seq *args); static int symtable_implicit_arg(struct symtable *st, int pos); static int symtable_visit_annotations(struct symtable *st, stmt_ty s); +static int symtable_visit_withitem(struct symtable *st, withitem_ty item); static identifier top = NULL, lambda = NULL, genexpr = NULL, @@ -1305,10 +1306,7 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s) /* nothing to do here */ break; case With_kind: - VISIT(st, expr, s->v.With.context_expr); - if (s->v.With.optional_vars) { - VISIT(st, expr, s->v.With.optional_vars); - } + VISIT_SEQ(st, withitem, s->v.With.items); VISIT_SEQ(st, stmt, s->v.With.body); break; } @@ -1540,6 +1538,16 @@ symtable_visit_excepthandler(struct symtable *st, excepthandler_ty eh) return 1; } +static int +symtable_visit_withitem(struct symtable *st, withitem_ty item) +{ + VISIT(st, expr, item->context_expr); + if (item->optional_vars) { + VISIT(st, expr, item->optional_vars); + } + return 1; +} + static int symtable_visit_alias(struct symtable *st, alias_ty a) |