Disallow undesirable implicit reexport with ImportFrom#12704
Merged
Conversation
Fixes python#12689 We always hid e.g. `import concurrent`, but looks like mypy never hid `from concurrent import futures`. It's possible this fix is pretty breaking for users, let's see what primer thinks. I last touched this logic in python#11707, which fixed cases involving implicitly reexported symbols that shared the name of a module
This comment has been minimized.
This comment has been minimized.
hauntsaninja
pushed a commit
to hauntsaninja/pytest
that referenced
this pull request
May 1, 2022
I'm fixing a bug in mypy's --no-implicit-reexport logic in python/mypy#12704 and mypy-primer flagged this
This was referenced May 1, 2022
Collaborator
Author
|
Okay, I think this change might be good? Opened pytest-dev/pytest#9906 and psycopg/psycopg#287 for the two mypy-primer hits. |
bluetech
pushed a commit
to pytest-dev/pytest
that referenced
this pull request
May 1, 2022
I'm fixing a bug in mypy's --no-implicit-reexport logic in python/mypy#12704 and mypy-primer flagged this
JukkaL
reviewed
May 9, 2022
| or fullname not in self.modules | ||
| # but given `from somewhere import random_unrelated_module` we should hide | ||
| # random_unrelated_module | ||
| or not fullname.startswith(self.cur_mod_id) |
Collaborator
There was a problem hiding this comment.
What if there's a partial prefix, e.g. foo.ba vs foo.bar?
Collaborator
Author
There was a problem hiding this comment.
Thanks, was a little sloppy. Fixed and added a test.
Contributor
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Gobot1234
pushed a commit
to Gobot1234/mypy
that referenced
this pull request
Aug 12, 2022
Fixes python#12689 We always hid e.g. `import concurrent`, but looks like mypy never hid `from concurrent import futures`. It's possible this fix is pretty breaking for users, let's see what primer thinks. I last touched this logic in python#11707, which fixed cases involving implicitly reexported symbols that shared the name of a module Co-authored-by: hauntsaninja <>
imgbot Bot
pushed a commit
to kkipngenokoech/pytest
that referenced
this pull request
Apr 18, 2026
I'm fixing a bug in mypy's --no-implicit-reexport logic in python/mypy#12704 and mypy-primer flagged this
imgbot Bot
pushed a commit
to kkipngenokoech/pytest
that referenced
this pull request
Apr 18, 2026
I'm fixing a bug in mypy's --no-implicit-reexport logic in python/mypy#12704 and mypy-primer flagged this
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #12689
We always hid e.g.
import concurrent, but looks like mypynever hid
from concurrent import futures. It's possible this fix ispretty breaking for users, let's see what primer thinks.
I last touched this logic in #11707, which fixed cases involving
implicitly reexported symbols that shared the name of a module