summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-03-19 18:56:50 (GMT)
committerGeorg Brandl <georg@python.org>2007-03-19 18:56:50 (GMT)
commite66c8c7c127370ab7d0055f98053caad48cbc135 (patch)
treef1b0cd053c45a78dc652c833815ea47a4bc94e7d /Python
parentd16e81aabe5448a90640694d57cdaefddf3a1a9f (diff)
downloadcpython-e66c8c7c127370ab7d0055f98053caad48cbc135.zip
cpython-e66c8c7c127370ab7d0055f98053caad48cbc135.tar.gz
cpython-e66c8c7c127370ab7d0055f98053caad48cbc135.tar.bz2
"from ... import x" should not be a syntax error... make
import_stmt accept ELLIPSes and DOTs.
Diffstat (limited to 'Python')
-rw-r--r--Python/ast.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Python/ast.c b/Python/ast.c
index 8180b42..777c00e 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -2406,8 +2406,8 @@ ast_for_import_stmt(struct compiling *c, const node *n)
/*
import_stmt: import_name | import_from
import_name: 'import' dotted_as_names
- import_from: 'from' ('.'* dotted_name | '.') 'import'
- ('*' | '(' import_as_names ')' | import_as_names)
+ import_from: 'from' (('.' | '...')* dotted_name | ('.' | '...')+)
+ 'import' ('*' | '(' import_as_names ')' | import_as_names)
*/
int lineno;
int col_offset;
@@ -2445,6 +2445,10 @@ ast_for_import_stmt(struct compiling *c, const node *n)
mod = alias_for_import_name(c, CHILD(n, idx));
idx++;
break;
+ } else if (TYPE(CHILD(n, idx)) == ELLIPSIS) {
+ /* three consecutive dots are tokenized as one ELLIPSIS */
+ ndots += 3;
+ continue;
} else if (TYPE(CHILD(n, idx)) != DOT) {
break;
}