]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] GH-125069: Fix inconsistent joining in `WindowsPath(PosixPath(...))` (GH-12515...
authorBarney Gale <barney.gale@gmail.com>
Sun, 13 Oct 2024 18:18:41 +0000 (19:18 +0100)
committerGitHub <noreply@github.com>
Sun, 13 Oct 2024 18:18:41 +0000 (18:18 +0000)
commitf49221af4609ea98e0e41bfae0d056f98bdccae4
tree558360d13675c1705b520bd2f5ba0f92b10e5c8c
parent243a8a9d68a87d103340b894366497101e6b0226
[3.12] GH-125069: Fix inconsistent joining in `WindowsPath(PosixPath(...))` (GH-125156) (#125410)

`PurePath.__init__()` incorrectly uses the `_raw_paths` of a given
`PurePath` object with a different flavour, even though the procedure to
join path segments can differ between flavours.

This change makes the `_raw_paths`-enabled deferred joining apply _only_
when the path flavours match.

(cherry picked from commit cb8e5995d89d9b90e83cf43310ec50e177484e70)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Lib/pathlib.py
Lib/test/test_pathlib.py
Misc/NEWS.d/next/Library/2024-10-08-21-17-16.gh-issue-125069.0RP0Mx.rst [new file with mode: 0644]