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

Incorrect handling of proxy imports #7067

Closed
AMDmi3 opened this issue Jun 25, 2019 · 2 comments
Closed

Incorrect handling of proxy imports #7067

AMDmi3 opened this issue Jun 25, 2019 · 2 comments
Labels
bug mypy got something wrong

Comments

@AMDmi3
Copy link

AMDmi3 commented Jun 25, 2019

Regression in 0.710 (still not fixed in 0.711). Not sure how it's called properly, but the problem is that mypy doesn't properly handle symbols imported from a package which imports them too. Example:

provider.py

def foobar1() -> None:
    pass
def foobar2() -> None:
    pass
def foobar3() -> None:
    pass

proxy.py

from provider import foobar1, foobar2, foobar3

main.py

from proxy import foobar1, foobar2, foobar3

main.py runs without errors and mypy 0.701 doesn't complain. However mypy 0.710 does:

main.py:1: error: Module 'proxy' has no attribute 'foobar1'; maybe "foobar3" or "foobar2"?
main.py:1: error: Module 'proxy' has no attribute 'foobar2'; maybe "foobar3" or "foobar1"?
main.py:1: error: Module 'proxy' has no attribute 'foobar3'; maybe "foobar2" or "foobar1"?

It's funny it complains on the very names it suggests. Adding __all__ to proxy.py doesn't help (however IMO it should work regardless).

@ethanhs ethanhs added the bug mypy got something wrong label Jun 25, 2019
@JelleZijlstra
Copy link
Member

Are you using --strict? This sounds like the behavior of the --no-implicit-reexport flag (documented at https://mypy.readthedocs.io/en/latest/command_line.html#miscellaneous-strictness-flags), which is included in --strict.

@AMDmi3
Copy link
Author

AMDmi3 commented Jun 25, 2019

Yes, I am. Thanks for the hint and sorry for the noise. I'm seeing this problem in third party code too, will link them to this issue.

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

3 participants