mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Fix bug that allowed future statements virtually anywhere in a module.
If we exit via the break here, we need to set ff_last_lineno or FUTURE_POSSIBLE() will remain true. The bug affected statements containing a variety of expressions, but not all expressions. It has been present since Python 2.2.
This commit is contained in:
parent
1f1d252f51
commit
c9add9a483
1 changed files with 1 additions and 2 deletions
|
@ -93,7 +93,6 @@ future_parse(PyFutureFeatures *ff, node *n, const char *filename)
|
||||||
{
|
{
|
||||||
int i, r;
|
int i, r;
|
||||||
loop:
|
loop:
|
||||||
|
|
||||||
switch (TYPE(n)) {
|
switch (TYPE(n)) {
|
||||||
|
|
||||||
case single_input:
|
case single_input:
|
||||||
|
@ -222,6 +221,7 @@ future_parse(PyFutureFeatures *ff, node *n, const char *filename)
|
||||||
n = CHILD(n, 0);
|
n = CHILD(n, 0);
|
||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
|
ff->ff_last_lineno = n->n_lineno;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case atom:
|
case atom:
|
||||||
|
@ -258,4 +258,3 @@ PyNode_Future(node *n, const char *filename)
|
||||||
}
|
}
|
||||||
return ff;
|
return ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue