-
-
Notifications
You must be signed in to change notification settings - Fork 34k
GH-78079: Fix UNC device path root normalization in pathlib #102003
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
barneygale
merged 10 commits into
python:main
from
barneygale:gh-78079-win-device-path-roots
Apr 14, 2023
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
99f62bc
GH-78079: Fix UNC device path root normalization in pathlib
barneygale 6651b67
A few more test cases
barneygale 87519ba
Merge branch 'main' into gh-78079-win-device-path-roots
barneygale c444a3c
Update Lib/pathlib.py
barneygale 36623c0
Fix handling of UNC paths with incomplete drives in glob(), walk(), etc.
barneygale aea236e
Test handling of UNC paths with incomplete drives in joinpath()
barneygale bb0af91
Merge branch 'main' into gh-78079-win-device-path-roots
barneygale f412f87
Merge branch 'main' into gh-78079-win-device-path-roots
barneygale 8ff07fc
Merge branch 'main' into gh-78079-win-device-path-roots
barneygale 723a5aa
Merge branch 'main' into gh-78079-win-device-path-roots
barneygale 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
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
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
You are viewing a condensed version of this merge commit. You can view the full changes here.
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.
Whoa, we
sys.interneverything? That seems like a painful memory leak. Would we be better off with a class levellru_cache'd function1?Don't we already know that
relwill bestrhere? If it's bytes,str(x)is the wrong conversion anyway. Maybe the intern function should becls._flavour.str_and_intern?Footnotes
@lru_cache(max_size=REASONABLE_VALUE) def intern(x): return x↩Uh oh!
There was an error while loading. Please reload this page.
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.
The interning of the path parts is longstanding pathlib behaviour. Honestly I don't know enough about the benefits/drawbacks of interning to say whether it's reasonable.
We know that it's an instance of
str(and notbytes), but we don't know whether it's a truestrobject (required bysys.intern()).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.
Is it really all that bad?
sys.intern()callsPyUnicode_InternInPlace(), notPyUnicode_InternImmortal(). An interned string gets deallocated based on its reference count, like any other object. For example: