Mercurial > cpython-lru_cache-weakref
diff Modules/parsermodule.c @ 62790:fb360c079059
Issue #9130: Validate ellipsis tokens in relative imports.
| author | Mark Dickinson <dickinsm@gmail.com> |
|---|---|
| date | Sun, 04 Jul 2010 18:38:57 +0000 |
| parents | c6f16b8cb858 |
| children | 724920a015f7 |
line wrap: on
line diff
--- a/Modules/parsermodule.c Sun Jul 04 18:15:26 2010 +0000 +++ b/Modules/parsermodule.c Sun Jul 04 18:38:57 2010 +0000 @@ -1754,17 +1754,17 @@ && validate_dotted_as_names(CHILD(tree, 1))); } -/* Helper function to count the number of leading dots in +/* Helper function to count the number of leading dots (or ellipsis tokens) in * 'from ...module import name' */ static int count_from_dots(node *tree) { - int i; - for (i = 1; i < NCH(tree); i++) - if (TYPE(CHILD(tree, i)) != DOT) - break; - return i-1; + int i; + for (i = 1; i < NCH(tree); i++) + if (TYPE(CHILD(tree, i)) != DOT && TYPE(CHILD(tree, i)) != ELLIPSIS) + break; + return i - 1; } /* import_from: ('from' ('.'* dotted_name | '.'+)
