diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/parsermodule.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c index 097c450..e1b7a2b 100644 --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -1886,8 +1886,8 @@ count_from_dots(node *tree) return i-1; } -/* 'from' ('.'* dotted_name | '.') 'import' ('*' | '(' import_as_names ')' | - * import_as_names +/* import_from: ('from' ('.'* dotted_name | '.'+) + * 'import' ('*' | '(' import_as_names ')' | import_as_names)) */ static int validate_import_from(node *tree) @@ -1897,7 +1897,8 @@ validate_import_from(node *tree) int havename = (TYPE(CHILD(tree, ndots + 1)) == dotted_name); int offset = ndots + havename; int res = validate_ntype(tree, import_from) - && (nch >= 4 + ndots) + && (offset >= 1) + && (nch >= 3 + offset) && validate_name(CHILD(tree, 0), "from") && (!havename || validate_dotted_name(CHILD(tree, ndots + 1))) && validate_name(CHILD(tree, offset + 1), "import"); |