Skip to content

Missing imports don't obey --no-implicit-reexport #9517

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
hauntsaninja opened this issue Oct 1, 2020 · 0 comments · Fixed by #9530
Closed

Missing imports don't obey --no-implicit-reexport #9517

hauntsaninja opened this issue Oct 1, 2020 · 0 comments · Fixed by #9530
Labels
bug mypy got something wrong

Comments

@hauntsaninja
Copy link
Collaborator

Noticed this while making #9515, will fix once it's merged. Related to the problem behind #8649, which I fixed a while ago, but was timid about and hence didn't think about this bug at that time.

~/tmp/rexp λ cat x.py
from mystery import a, b as b, c as d
~/tmp/rexp λ cat y.py
from x import a
from x import b
from x import c
from x import d
~/tmp/rexp λ mypy --no-implicit-reexport .
x.py:1: error: Cannot find implementation or library stub for module named 'mystery'
x.py:1: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
y.py:3: error: Module 'x' has no attribute 'c'
Found 2 errors in 2 files (checked 2 source files)

whereas you'd expect:

~/tmp/rexp λ mypy --no-implicit-reexport . 
x.py:1: error: Cannot find implementation or library stub for module named 'mystery'
x.py:1: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
y.py:1: error: Module 'x' does not explicitly export attribute 'a'; implicit reexport disabled
y.py:3: error: Module 'x' has no attribute 'c'
y.py:4: error: Module 'x' does not explicitly export attribute 'd'; implicit reexport disabled
Found 4 errors in 2 files (checked 2 source files)
@hauntsaninja hauntsaninja added the bug mypy got something wrong label Oct 1, 2020
hauntsaninja pushed a commit to hauntsaninja/mypy that referenced this issue Oct 4, 2020
hauntsaninja pushed a commit to hauntsaninja/mypy that referenced this issue Oct 4, 2020
hauntsaninja pushed a commit to hauntsaninja/mypy that referenced this issue Oct 4, 2020
hauntsaninja added a commit that referenced this issue Oct 4, 2020
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

Successfully merging a pull request may close this issue.

1 participant