Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-81790: support "UNC" device paths inntpath.splitdrive()#91882
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 ourterms of service andprivacy 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 from1 commit
c97bfbf2da18ba49f937357840d4264d79e0652b12bcc561c40c1eaf34358c80213a72a7fa62b992f59d3f163ff4244684471e3b48f9ab9aFile 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
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -146,31 +146,28 @@ def splitdrive(p): | ||
| sep = b'\\' | ||
| altsep = b'/' | ||
| colon = b':' | ||
| dev_prefix = b'\\\\?\\' | ||
| unc_prefix = b'UNC\\' | ||
barneygale marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| else: | ||
| sep = '\\' | ||
| altsep = '/' | ||
| colon = ':' | ||
| dev_prefix = '\\\\?\\' | ||
| unc_prefix = 'UNC\\' | ||
| normp = p.replace(altsep, sep) | ||
| start = 0 | ||
| if normp[:4] == dev_prefix: | ||
| start = 4 | ||
| if normp[4:8] == unc_prefix: | ||
| # prepend slashes to machine name | ||
| normp = 8 * sep + normp[8:] | ||
| start = 6 | ||
| if (normp[start:start + 2] == sep*2) and (normp[start + 2:start + 3] != sep): | ||
barneygale marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| # is a UNC path: | ||
| # vvvvvvvvvvvvvvvvvvvv drive letter or UNC path | ||
| # \\machine\mountpoint\directory\etc\... | ||
| # directory ^^^^^^^^^^^^^^^ | ||
| index = normp.find(sep,start + 2) | ||
| if index == -1: | ||
| return p[:0], p | ||
| index2 = normp.find(sep, index + 1) | ||
| @@ -181,8 +178,8 @@ def splitdrive(p): | ||
| if index2 == -1: | ||
| index2 = len(p) | ||
| return p[:index2], p[index2:] | ||
| if normp[start + 1:start + 2] == colon: | ||
barneygale marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| return p[:start + 2], p[start + 2:] | ||
| return p[:0], p | ||