summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2000-08-22 02:43:07 (GMT)
committerSkip Montanaro <skip@pobox.com>2000-08-22 02:43:07 (GMT)
commit46dfa5f4ed16c64edc845fffd4a5e2517415a2d6 (patch)
tree0357b1bd28ca24138dec5bac32bab2f70e988929 /Python
parent2823f03a56451f3187a1d85ffcef107f00f6f48e (diff)
downloadcpython-46dfa5f4ed16c64edc845fffd4a5e2517415a2d6.zip
cpython-46dfa5f4ed16c64edc845fffd4a5e2517415a2d6.tar.gz
cpython-46dfa5f4ed16c64edc845fffd4a5e2517415a2d6.tar.bz2
require list comprehensions to start with a for clause
Diffstat (limited to 'Python')
-rw-r--r--Python/compile.c8
-rw-r--r--Python/graminit.c10
2 files changed, 9 insertions, 9 deletions
diff --git a/Python/compile.c b/Python/compile.c
index e09204e..f239bb6 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1043,7 +1043,7 @@ com_list_iter(struct compiling *c,
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_list_comprehension(struct compiling *c, node *n)
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 @@ com_list_comprehension(struct compiling *c, node *n)
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;
diff --git a/Python/graminit.c b/Python/graminit.c
index a62b62e..c8570ff 100644
--- a/Python/graminit.c
+++ b/Python/graminit.c
@@ -1317,7 +1317,7 @@ static state states_59[4] = {
{1, arcs_59_3},
};
static arc arcs_60_0[2] = {
- {128, 1},
+ {120, 1},
{129, 1},
};
static arc arcs_60_1[1] = {
@@ -1340,7 +1340,7 @@ static arc arcs_61_3[1] = {
{9, 4},
};
static arc arcs_61_4[2] = {
- {120, 5},
+ {128, 5},
{0, 4},
};
static arc arcs_61_5[1] = {
@@ -1361,7 +1361,7 @@ static arc arcs_62_1[1] = {
{21, 2},
};
static arc arcs_62_2[2] = {
- {120, 3},
+ {128, 3},
{0, 2},
};
static arc arcs_62_3[1] = {
@@ -1622,7 +1622,7 @@ static label labels[130] = {
{25, 0},
{2, 0},
{3, 0},
- {316, 0},
+ {317, 0},
{1, "lambda"},
{314, 0},
{307, 0},
@@ -1630,7 +1630,7 @@ static label labels[130] = {
{309, 0},
{1, "class"},
{315, 0},
- {317, 0},
+ {316, 0},
{318, 0},
};
grammar _PyParser_Grammar = {