[Python-checkins] r42372 - python/branches/ast-objects/Python/ast.c python/branches/ast-objects/Python/symtable.c

neal.norwitz python-checkins at python.org
Wed Feb 15 06:18:45 CET 2006


Author: neal.norwitz
Date: Wed Feb 15 06:18:45 2006
New Revision: 42372

Modified:
   python/branches/ast-objects/Python/ast.c
   python/branches/ast-objects/Python/symtable.c
Log:
Further updates from Simon Burton.  Gets a little farther

Modified: python/branches/ast-objects/Python/ast.c
==============================================================================
--- python/branches/ast-objects/Python/ast.c	(original)
+++ python/branches/ast-objects/Python/ast.c	Wed Feb 15 06:18:45 2006
@@ -224,7 +224,7 @@
                     s = ast_for_stmt(&c, ch);
                     if (!s)
                         goto error;
-                    PyList_SET_ITEM(stmts, pos++, s);
+                    STEAL_ITEM(stmts, pos++, s);
                 }
                 else {
                     ch = CHILD(ch, 0);
@@ -233,7 +233,7 @@
                         s = ast_for_stmt(&c, CHILD(ch, j * 2));
                         if (!s)
                             goto error;
-                        PyList_SET_ITEM(stmts, pos++, s);
+                        STEAL_ITEM(stmts, pos++, s);
                     }
                 }
             }
@@ -542,7 +542,7 @@
         }
 
         /* assert(i / 2 < seq->size); */ // ??
-        PyList_SET_ITEM(seq, i / 2, expression);
+        STEAL_ITEM(seq, i / 2, expression);
     }
     result = seq;
     Py_INCREF(result);
@@ -581,7 +581,7 @@
             arg = compiler_complex_args(CHILD(CHILD(n, 2*i), 1));
         if (!set_context(arg, store, n))
             goto error;
-        PyList_SET_ITEM(args, i, arg);
+        STEAL_ITEM(args, i, arg);
     }
 
     result = Tuple(args, store, LINENO(n));
@@ -2206,11 +2206,12 @@
         e = ast_for_expr(c, CHILD(n, i));
         if (!e)
             goto error;
-        PyList_SET_ITEM(seq,i/2,e); // e=NULL; // ???
+        PyList_SET_ITEM(seq,i/2,e);
         if (context) {
             if (!set_context(e, context, CHILD(n, i)))
                     goto error;
         }
+        e = NULL;
     }
     result = seq;
 
@@ -2481,7 +2482,7 @@
             if (!import_alias) {
                 goto error;
             }
-            PyList_SET_ITEM(aliases, pos++, import_alias);
+            STEAL_ITEM(aliases, pos++, import_alias);
         }
 
         for (i = 0; i < NCH(n); i += 2) {
@@ -2489,7 +2490,7 @@
             if (!import_alias) {
                 goto error;
             }
-            PyList_SET_ITEM(aliases, pos++, import_alias);
+            STEAL_ITEM(aliases, pos++, import_alias);
         }
         assert(pos == PyList_GET_SIZE(aliases));
         Py_INCREF(alias_name(mod));

Modified: python/branches/ast-objects/Python/symtable.c
==============================================================================
--- python/branches/ast-objects/Python/symtable.c	(original)
+++ python/branches/ast-objects/Python/symtable.c	Wed Feb 15 06:18:45 2006
@@ -1175,13 +1175,13 @@
 	for (i = 0; i < PyList_GET_SIZE(args); i++) {
 		PyObject *arg = PyList_GET_ITEM(args, i);
 		if (expr_kind(arg) == Name_kind) {
-			assert(Name_ctx(arg) == Param ||
-                               (Name_ctx(arg) == Store && !toplevel));
+			assert(expr_context_kind(Name_ctx(arg)) == Param_kind ||
+                               (expr_context_kind(Name_ctx(arg)) == Store_kind && !toplevel));
 			if (!symtable_add_def(st, Name_id(arg), DEF_PARAM))
 				return 0;
 		}
 		else if (expr_kind(arg) == Tuple_kind) {
-			assert(Tuple_ctx(arg) == Store);
+			assert(expr_context_kind(Tuple_ctx(arg)) == Store_kind);
                         complex = 1;
 			if (toplevel) {
 				if (!symtable_implicit_arg(st, i))


More information about the Python-checkins mailing list