Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 35.2k
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
99f62bc6651b6787519bac444a3c36623c0aea236ebb0af91f412f878ff07fc723a5aaFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -322,9 +322,14 @@ def _parse_path(cls, path): | ||
| if altsep: | ||
| path = path.replace(altsep, sep) | ||
| drv, root, rel = cls._flavour.splitroot(path) | ||
| if drv.startswith(sep): | ||
| # pathlib assumes that UNC paths always have a root. | ||
| root = sep | ||
| if not root and drv.startswith(sep) and not drv.endswith(sep): | ||
| drv_parts = drv.split(sep) | ||
| if len(drv_parts) == 4 and drv_parts[2] not in '?.': | ||
| # e.g. //server/share | ||
| root = sep | ||
| elif len(drv_parts) == 6: | ||
| # e.g. //?/unc/server/share | ||
| root = sep | ||
| parsed = [sys.intern(str(x)) for x in rel.split(sep) if x and x != '.'] | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whoa, we Don't we already know that Footnotes
| ||
| return drv, root, parsed | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Fix incorrect normalization of UNC device path roots, and partial UNC share | ||
| path roots, in :class:`pathlib.PurePath`. Pathlib no longer appends a | ||
| trailing slash to such paths. |
Uh oh!
There was an error while loading. Please reload this page.