Skip to content

Incorrect detection of name after failed import #10042

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
AlbertoEAF opened this issue Feb 6, 2021 · 3 comments
Closed

Incorrect detection of name after failed import #10042

AlbertoEAF opened this issue Feb 6, 2021 · 3 comments
Labels
bug mypy got something wrong

Comments

@AlbertoEAF
Copy link

The following:

# File bug.py
try:
    import simplejson as json
except (ImportError, SyntaxError):
    import json

results in:

mypy.py:4: error: Name 'json' already defined (by an import)
Found 1 error in 1 file (checked 1 source file)

under mypy 0.8 in Ubuntu18.04 with python 3.7.4. (mypy bug.py)

@AlbertoEAF AlbertoEAF added the bug mypy got something wrong label Feb 6, 2021
@pspacek
Copy link

pspacek commented Jul 8, 2022

FTR this is reproducible using mypy==0.961.

@pspacek
Copy link

pspacek commented Jul 8, 2022

Hmm, maybe this is a duplicate of much older #1153.

@JelleZijlstra
Copy link
Member

Yes, that's basically the same thing.

@JelleZijlstra JelleZijlstra closed this as not planned Won't fix, can't repro, duplicate, stale Jul 8, 2022
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