You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
So here's a fix for part two of #5758. The way it works is, first, when find_module() encounters an installed non-stub package with a py.typed marker underneath a namespace parent module, it remembers the namespace ancestor(s) in a special cache dict. Then if a later request for one of those ancestors is received and it is not found in the usual way, the cached ancestor's directory is produced.
But that's not all that's needed! @macbeth322 -- you were spot on with your suggestion that this had something to do with the ancestor dependencies in all_imported_modules_in_file()! I ended up moving the "main" dependency to the top so it precedes the ancestors; that way, the first call to find_module() is e.g. find_module('foo.bar.baz'), which squirrels away the namespace ancestor as I described above.
This order dependency is ugly and caused a bunch of tests to fail (since the errors about missing packages come out in a different order) but it's the best I could come up with.
(As I write this there are some more failures, I have to look into those later.)
The reason will be displayed to describe this comment to others. Learn more.
Looks good, with one comment request and one test request.
If the test request is super painful then it is probably OK to skip for now if we need to cherry-pick this, but it seems like the sort of thing that is super easy to break later, so.
Added a comment. I believe adding a test for this situation would require adding a big chunk of code to testpep561.py. I'd rather focus on other aspects of the release, but I'll file a bug to remind myself.
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.
No description provided.