[Python-checkins] r50987 - python/trunk/Python/ast.c python/trunk/Python/compile.c

neal.norwitz python-checkins at python.org
Sun Jul 30 21:18:14 CEST 2006


Author: neal.norwitz
Date: Sun Jul 30 21:18:13 2006
New Revision: 50987

Modified:
   python/trunk/Python/ast.c
   python/trunk/Python/compile.c
Log:
Add some asserts and update comments

Modified: python/trunk/Python/ast.c
==============================================================================
--- python/trunk/Python/ast.c	(original)
+++ python/trunk/Python/ast.c	Sun Jul 30 21:18:13 2006
@@ -622,10 +622,10 @@
     }
     args = (n_args ? asdl_seq_new(n_args, c->c_arena) : NULL);
     if (!args && n_args)
-    	return NULL; /* Don't need to go to NULL; nothing allocated */
+    	return NULL; /* Don't need to goto error; no objects allocated */
     defaults = (n_defaults ? asdl_seq_new(n_defaults, c->c_arena) : NULL);
     if (!defaults && n_defaults)
-        goto error;
+    	return NULL; /* Don't need to goto error; no objects allocated */
 
     /* fpdef: NAME | '(' fplist ')'
        fplist: fpdef (',' fpdef)* [',']
@@ -644,6 +644,7 @@
                     expr_ty expression = ast_for_expr(c, CHILD(n, i + 2));
                     if (!expression)
                             goto error;
+                    assert(defaults != NULL);
                     asdl_seq_SET(defaults, j++, expression);
                     i += 2;
 		    found_default = 1;

Modified: python/trunk/Python/compile.c
==============================================================================
--- python/trunk/Python/compile.c	(original)
+++ python/trunk/Python/compile.c	Sun Jul 30 21:18:13 2006
@@ -3031,6 +3031,7 @@
 		return 0;
 	s = e->v.BoolOp.values;
 	n = asdl_seq_LEN(s) - 1;
+	assert(n >= 0);
 	for (i = 0; i < n; ++i) {
 		VISIT(c, expr, (expr_ty)asdl_seq_GET(s, i));
 		ADDOP_JREL(c, jumpi, end);


More information about the Python-checkins mailing list