mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Fis SF bug #442647: not all forms of legal future statements were
parsed correctly. Now they are.
This commit is contained in:
parent
e31c2eeb41
commit
3c033230ec
1 changed files with 9 additions and 3 deletions
|
@ -175,15 +175,21 @@ future_hack(parser_state *ps)
|
||||||
{
|
{
|
||||||
node *n = ps->p_stack.s_top->s_parent;
|
node *n = ps->p_stack.s_top->s_parent;
|
||||||
node *ch;
|
node *ch;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (strcmp(STR(CHILD(n, 0)), "from") != 0)
|
if (strcmp(STR(CHILD(n, 0)), "from") != 0)
|
||||||
return;
|
return;
|
||||||
ch = CHILD(n, 1);
|
ch = CHILD(n, 1);
|
||||||
if (strcmp(STR(CHILD(ch, 0)), "__future__") != 0)
|
if (strcmp(STR(CHILD(ch, 0)), "__future__") != 0)
|
||||||
return;
|
return;
|
||||||
ch = CHILD(n, 3);
|
for (i = 3; i < NCH(n); i += 2) {
|
||||||
if (NCH(ch) == 1 && strcmp(STR(CHILD(ch, 0)), "generators") == 0)
|
ch = CHILD(n, i);
|
||||||
ps->p_generators = 1;
|
if (NCH(ch) >= 1 && TYPE(CHILD(ch, 0)) == NAME &&
|
||||||
|
strcmp(STR(CHILD(ch, 0)), "generators") == 0) {
|
||||||
|
ps->p_generators = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue