summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-02-28 02:26:14 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-02-28 02:26:14 (GMT)
commit280c81a9402dfa39159c3c01dec217b2ad55c8c9 (patch)
treebc04083f723967d61e93ccc78dfcde379995305b
parent39e2f3f82499e2c06c092d38b77d554bee6f31e8 (diff)
downloadcpython-280c81a9402dfa39159c3c01dec217b2ad55c8c9.zip
cpython-280c81a9402dfa39159c3c01dec217b2ad55c8c9.tar.gz
cpython-280c81a9402dfa39159c3c01dec217b2ad55c8c9.tar.bz2
Need to support single_input explicitly so from __future__ imports
are legal at the interactive interpreter prompt. They don't do anything yet...
-rw-r--r--Python/future.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Python/future.c b/Python/future.c
index 18bae1f..37d5476 100644
--- a/Python/future.c
+++ b/Python/future.c
@@ -71,6 +71,13 @@ future_parse(PyFutureFeatures *ff, node *n, char *filename)
switch (TYPE(n)) {
+ case single_input:
+ if (TYPE(CHILD(n, 0)) == simple_stmt) {
+ n = CHILD(n, 0);
+ goto loop;
+ }
+ return 0;
+
case file_input:
for (i = 0; i < NCH(n); i++) {
node *ch = CHILD(n, i);
@@ -157,6 +164,7 @@ future_parse(PyFutureFeatures *ff, node *n, char *filename)
return 0;
if (future_check_features(ff, n) < 0)
return -1;
+ ff->ff_last_lineno = n->n_lineno + 1;
return 1;
}