Open
Description
Feature or enhancement
This was probably never an intentional feature, and results in subtle behaviour:
>>> from pathlib import PurePosixPath, PureWindowsPath
>>> from os import fspath
>>> p = PureWindowsPath('foo', 'bar')
>>> PurePosixPath(p)
PurePosixPath('foo/bar')
>>> p = fspath(p)
>>> PurePosixPath(p)
PurePosixPath('foo\\bar')
PurePath
is documented as accepting os.PathLike
objects, and so the additional os.fspath()
call shouldn't really make a difference. See #103631 for why it does (spoiler: backwards-compatibility).
Folks can use PurePosixPath(PureWindowsPath().as_posix())
instead, which makes it more explicit that backwards-to-forwards slash conversion is desired.