diff Python/symtable.c @ 70438:9b11cc4e2918

reflect with statements with multiple items in the AST (closes #12106)
author Benjamin Peterson <benjamin@python.org>
date Fri, 27 May 2011 13:58:08 -0500
parents b6fe63c914e4
children e0e663132363
line wrap: on
line diff
--- a/Python/symtable.c	Fri May 27 16:50:40 2011 +0200
+++ b/Python/symtable.c	Fri May 27 13:58:08 2011 -0500
@@ -185,6 +185,7 @@
 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 @@
         /* 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 @@
     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)