diff Python/compile.c @ 14117:ac8809959d01 legacy-trunk

require list comprehensions to start with a for clause
author Skip Montanaro <skip@pobox.com>
date Tue, 22 Aug 2000 02:43:07 +0000
parents d809b9b75b99
children 21ec69a56228
line wrap: on
line diff
--- a/Python/compile.c	Tue Aug 22 02:04:46 2000 +0000
+++ b/Python/compile.c	Tue Aug 22 02:43:07 2000 +0000
@@ -1043,7 +1043,7 @@
 static void
 com_list_comprehension(struct compiling *c, node *n)
 {
-	/* listmaker: test list_iter */
+	/* listmaker: test list_for */
 	char tmpname[12];
 	sprintf(tmpname, "__%d__", ++c->c_tmpname);
 	com_addoparg(c, BUILD_LIST, 0);
@@ -1052,7 +1052,7 @@
 	com_addopnamestr(c, LOAD_ATTR, "append");
 	com_addopnamestr(c, STORE_NAME, tmpname);
 	com_pop(c, 1);
-	com_list_iter(c, n, CHILD(n, 0), tmpname);
+	com_list_for(c, CHILD(n, 1), CHILD(n, 0), tmpname);
 	com_addopnamestr(c, DELETE_NAME, tmpname);
 	--c->c_tmpname;
 }
@@ -1060,8 +1060,8 @@
 static void
 com_listmaker(struct compiling *c, node *n)
 {
-	/* listmaker: test ( list_iter | (',' test)* [','] ) */
-	if (NCH(n) > 1 && TYPE(CHILD(n, 1)) == list_iter)
+	/* listmaker: test ( list_for | (',' test)* [','] ) */
+	if (NCH(n) > 1 && TYPE(CHILD(n, 1)) == list_for)
 		com_list_comprehension(c, n);
 	else {
 		int len = 0;