Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Description

@hauntsaninja

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions