Skip to content

Commit c9add9a

Browse files
committed
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.
1 parent 1f1d252 commit c9add9a

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

Python/future.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ future_parse(PyFutureFeatures *ff, node *n, const char *filename)
9393
{
9494
int i, r;
9595
loop:
96-
9796
switch (TYPE(n)) {
9897

9998
case single_input:
@@ -222,6 +221,7 @@ future_parse(PyFutureFeatures *ff, node *n, const char *filename)
222221
n = CHILD(n, 0);
223222
goto loop;
224223
}
224+
ff->ff_last_lineno = n->n_lineno;
225225
break;
226226

227227
case atom:
@@ -258,4 +258,3 @@ PyNode_Future(node *n, const char *filename)
258258
}
259259
return ff;
260260
}
261-

0 commit comments

Comments
 (0)