Skip to content

Three dots (...) in relative import not accepted #585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JukkaL opened this issue Feb 22, 2015 · 0 comments
Closed

Three dots (...) in relative import not accepted #585

JukkaL opened this issue Feb 22, 2015 · 0 comments
Labels
bug mypy got something wrong

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Feb 22, 2015

If you have ... in a relative import, the parser crashes:

from ... import a

Here's the stack trace:

Traceback (most recent call last):
  File "scripts/mypy", line 169, in <module>
    main()
  File "scripts/mypy", line 34, in main
    type_check_only(path, module, bin_dir, options)
  File "scripts/mypy", line 78, in type_check_only
    python_path=options.python_path)
  File "/home/jukka/project/mypy/mypy/build.py", line 164, in build
    result = manager.process(UnprocessedFile(info, program_text))
  File "/home/jukka/project/mypy/mypy/build.py", line 342, in process
    next.process()
  File "/home/jukka/project/mypy/mypy/build.py", line 660, in process
    tree = self.parse(self.program_text, self.path)
  File "/home/jukka/project/mypy/mypy/build.py", line 739, in parse
    custom_typing_module=self.manager.custom_typing_module)
  File "/home/jukka/project/mypy/mypy/parse.py", line 80, in parse
    tree = parser.parse(s)
  File "/home/jukka/project/mypy/mypy/parse.py", line 117, in parse
    file = self.parse_file()
  File "/home/jukka/project/mypy/mypy/parse.py", line 125, in parse_file
    defs = self.parse_defs()
  File "/home/jukka/project/mypy/mypy/parse.py", line 248, in parse_defs
    defn, is_simple = self.parse_statement()
  File "/home/jukka/project/mypy/mypy/parse.py", line 668, in parse_statement
    stmt = self.parse_import_from()
  File "/home/jukka/project/mypy/mypy/parse.py", line 176, in parse_import_from
    name = self.parse_qualified_name()
  File "/home/jukka/project/mypy/mypy/parse.py", line 234, in parse_qualified_name
    tok = self.expect_type(Name)
  File "/home/jukka/project/mypy/mypy/parse.py", line 1529, in expect_type
    self.parse_error()
  File "/home/jukka/project/mypy/mypy/parse.py", line 1547, in parse_error
    self.parse_error_at(self.current())
  File "/home/jukka/project/mypy/mypy/parse.py", line 1558, in parse_error_at
    msg = 'Parse error before {}'.format(token_repr(tok))
  File "/home/jukka/project/mypy/mypy/parse.py", line 1672, in token_repr
    raise ValueError('Unknown token {}'.format(repr(tok)))
ValueError: Unknown token EllipsisToken( ...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

1 participant