Skip to content

Difference in behaviour of PureWindowsPath in 3.12.0b2 with multiple slashes #105881

Closed
@jnoortheen

Description

@jnoortheen

Bug report

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.

This can be reproduced like this

in Python 3.11

>>> from pathlib import PurePosixPath, PureWindowsPath
>>> PurePosixPath("///tmp")
PurePosixPath('/tmp')
>>> PureWindowsPath(r"\\\tmp")
PureWindowsPath('/tmp')

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.

Your environment

  • CPython versions tested on: 3.12.0b2
  • Operating system and architecture: Windows 64bit

Metadata

Metadata

Assignees

Labels

3.12only security fixes3.13bugs and security fixesOS-windowstopic-pathlibtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions