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

Fix caching of PEP 561 namespace packages with missing submodules #12250

Merged
merged 2 commits into from
Mar 21, 2022

Conversation

hauntsaninja
Copy link
Collaborator

@hauntsaninja hauntsaninja commented Feb 24, 2022

Fixes #12232

Another "fail every 2nd run" bug

if not self.is_module(sub_id):, the parent can come before another child, and we fail to resolve the parent.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

pyinstrument (https://github.com/joerick/pyinstrument)
- pyinstrument/vendor/appdirs.py:533: error: Cannot find implementation or library stub for module named "com.sun"
+ pyinstrument/vendor/appdirs.py:562: error: Cannot find implementation or library stub for module named "com.sun"

@hauntsaninja hauntsaninja marked this pull request as ready for review February 24, 2022 21:41
@@ -415,9 +415,9 @@ follow_imports = error
[file a.py]
/ # No error reported
[out]
main.py:1: error: Import of "a" ignored
main.py:1: note: (Using --follow-imports=error, module not passed on command line)
main.py:2: note: Revealed type is "Any"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually makes it match the comments in the test case

@hauntsaninja hauntsaninja requested a review from JukkaL March 1, 2022 22:34
@hauntsaninja
Copy link
Collaborator Author

Seems like no takers on reviews, so I'm going to go ahead and merge. Any fixes for namespace packages are probably really good to get in ahead of #9636

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cache causes mypy to fail every 2nd run for module importing from google.cloud
1 participant