Skip to content
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

pytype should not assume that "from . import X" is always a module import #882

Closed
rchen152 opened this issue Apr 9, 2021 · 1 comment
Closed
Labels
bug cat: stubs and 3p type stubs and third-party types

Comments

@rchen152
Copy link
Contributor

rchen152 commented Apr 9, 2021

Consider the following type stubs:

# foo/__init__.pyi
class Foo: ...
# foo/bar.pyi
from . import Foo
class Bar(Foo): ...

When parsing foo/bar.pyi, pytype fails with:

ParseError: Unexpected class base: Module(name='Foo', module_name='foo.Foo')

pytype erroneously assumes that Foo is a submodule. A workaround is to replace from . import Foo with from foo import Foo.

Context: python/typeshed#5192

@rchen152
Copy link
Contributor Author

rchen152 commented Oct 6, 2021

This seems to be fixed.

@rchen152 rchen152 closed this as completed Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cat: stubs and 3p type stubs and third-party types
Projects
None yet
Development

No branches or pull requests

1 participant