Repository navigation
gh-139899: Introduce MetaPathFinder.discover and PathEntryFinder.discover #139900
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
8099249
gh-139899: Introduce MetaPathFinder.discover and PathEntryFinder.disc…
FFY00 6816705
Fix doc reference
FFY00 31d1a8f
Remove specific doc references
FFY00 051cd1e
Fix docstrings
FFY00 c343d32
Revert "Remove specific doc references"
FFY00 a324d96
Fix news references
FFY00 dc6faa2
Add docs warning
FFY00 3be757f
Raise ValueError on invalid parent
FFY00 0da477f
Dedupe __path__ in PathFinder.discover
FFY00 282bef7
Use context manager and add error handling to os.scandir
FFY00 469dc2a
Raise ValueError on invalid parent
FFY00 c09a12e
Dedupe when package exists with multiple suffixes
FFY00 41cd071
Apply suggestions from code review
FFY00 5488e93
Add tests
FFY00 fc1de5f
Merge branch 'main' into gh-139899
brettcannon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Raise ValueError on invalid parent
Signed-off-by: Filipe Laíns <lains@riseup.net>
- Loading branch information
commit 3be757f44533809df1d770fc41a0728f42438711
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be
Nonewhen parent is a non-package module? make a nicer error message or should this situation use sys.path?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can it be a non-package module if it has a child? It could be a namespace package, but that's still a package, and
parent.submodule_search_locationsshould be an iterable objects when the spec is fully initialized, which it should always be at this point.Unless I am missing something? Do we support package-like module extensions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @gpshead is referring to the error case where
parent.submodule_search_locationsisNonebecause the caller supplied a "parent" spec from a non-package module. Instead of the default "'NoneType' object is not iterable" message from the failed iteration attempt, we should raise something more specific.