]> granicus.if.org Git - python/commitdiff
Fix bug that allowed future statements virtually anywhere in a module.
authorJeremy Hylton <jeremy@alum.mit.edu>
Fri, 4 Feb 2005 18:38:43 +0000 (18:38 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Fri, 4 Feb 2005 18:38:43 +0000 (18:38 +0000)
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.

Python/future.c

index 20d8dd290924ee7e8aba5ce79ef6e80294d72444..95d6a5c9a3224b539cbc976fcaf1f05d95fd1f42 100644 (file)
@@ -93,7 +93,6 @@ future_parse(PyFutureFeatures *ff, node *n, const char *filename)
 {
        int i, r;
  loop:
-
        switch (TYPE(n)) {
 
        case single_input:
@@ -222,6 +221,7 @@ future_parse(PyFutureFeatures *ff, node *n, const char *filename)
                        n = CHILD(n, 0);
                        goto loop;
                }
+                ff->ff_last_lineno = n->n_lineno;
                break;
 
        case atom:
@@ -258,4 +258,3 @@ PyNode_Future(node *n, const char *filename)
        }
        return ff;
 }
-