You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Difference in behaviour of PureWindowsPath in 3.12.0b2 with multiple slashes #105881
I was trying to add Python3.12 beta 2 to the test suit of xonsh . The tests on Windows were failing because of the difference in behaviour of PureWindowsPath.
but the same in Python 3.12.0b2 would be giving different result
In [1]: from pathlib import PurePosixPath, PureWindowsPath
In [2]: PurePosixPath("///tmp")
Out[2]: PurePosixPath('/tmp')
In [3]: PureWindowsPath(r"\\\tmp")
Out[3]: PureWindowsPath('///tmp')
I've checked the changelog and this change of behaviour wasn't mentioned in it.
In Python 3.12, all Windows paths beginning // or \\ are considered to be UNC paths, and so we don't remove leading slashes. In previous versions of Python the rules were more complex. More info here: #96290 (comment)
It's mentioned in the changelog (ctrl-f for "Fix handling of partial and invalid UNC drives in ntpath.splitdrive()") but the reST formatting of the entry is messed up. Will fix!
Activity
arhadthedev commentedon Jun 17, 2023
git bisectpoints to 8af8f52 (gh-102003). @barneygaleHow I performed the search, for reproducibility
script
git bisect start git bisect good v3.11.0 git bisect bad main git bisect run .\gh-105881.cmdgh-105881.cmd:gh-105881.py:barneygale commentedon Jun 17, 2023
In Python 3.12, all Windows paths beginning
//or\\are considered to be UNC paths, and so we don't remove leading slashes. In previous versions of Python the rules were more complex. More info here: #96290 (comment)It's mentioned in the changelog (ctrl-f for "Fix handling of partial and invalid UNC drives in ntpath.splitdrive()") but the reST formatting of the entry is messed up. Will fix!
jnoortheen commentedon Jun 17, 2023
Thanks for clarifying !