Repository navigation
Fix symlinked partial stub packages - #11516
Merged
Rich Chiodo (rchiodo) merged 1 commit intoJun 22, 2026
Merged
Rich Chiodo (rchiodo) merged 1 commit into
Rich Chiodo (rchiodo) merged 1 commit into
Conversation
Tamir Duberstein (tamird)
force-pushed
the
tamird/fix-partial-stub-symlinks
branch
from
June 21, 2026 14:08
bb657e1 to
57a8882
Compare
Collaborator
|
The fix itself looks correct and is well-targeted. Main ask: align the two new tests with the repo's documented exact-assertion pattern used by their peers (count-based asserts + a non-optional entry guard). There's also one optional robustness note on the readdir change for filesystems that report unknown dirent types. |
Classify this as a Pyright filesystem bug (B). A mapped entry can be a symlink even when its target is a file. Treating Dirent.isFile() as the virtual entry type therefore turns symlinked partial .pyi files into directories, and import resolution falls back to runtime source. Resolve mapped entries whose directory entry is not already known to be a file or directory. This covers symlinks and DT_UNKNOWN entries. Ignore dangling links and special-file targets rather than exposing them as directories. This preserves the partial stub overlay and its type precision.
Tamir Duberstein (tamird)
force-pushed
the
tamird/fix-partial-stub-symlinks
branch
from
June 22, 2026 12:56
57a8882 to
fb65044
Compare
Rich Chiodo (rchiodo)
approved these changes
Jun 22, 2026
Rich Chiodo (rchiodo)
left a comment
Collaborator
There was a problem hiding this comment.
Approved via Review Center.
Contributor
Author
|
Thanks for the review! It would be great to see this in a release soon. |
Contributor
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Collaborator
|
Thanks for the PR |
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.
Partial stub packages are overlaid onto their runtime packages. When a
file in the stub package is a symbolic link, its directory entry reports
that it is a link rather than a file.
ReadOnlyAugmentedFileSystemcurrently converts that entry to a virtual directory, so import
resolution ignores the
.pyiand falls back to the runtime.py.Resolve symbolic links before constructing virtual directory entries.
Dangling links and special files are omitted rather than exposed as
directories. This preserves the partial stub overlay for environments
that install wheel files as symbolic links.