gh-94909: fix joining of absolute and relative Windows paths in pathlib (GH-95450)

Have pathlib use `os.path.join()` to join arguments to the `PurePath` initialiser, which fixes a minor bug when handling relative paths with drives.

Previously:

```python
>>> from pathlib import PureWindowsPath
>>> a = 'C:/a/b'
>>> b = 'C:x/y'
>>> PureWindowsPath(a, b)
PureWindowsPath('C:x/y')
```

Now:

```python
>>> PureWindowsPath(a, b)
PureWindowsPath('C:/a/b/x/y')
```
This commit is contained in:
Barney Gale 2022-08-12 22:23:41 +01:00 committed by GitHub
parent a965db37f2
commit 187949ebf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 33 deletions

View file

@ -0,0 +1,2 @@
Fix incorrect joining of relative Windows paths with drives in
:class:`pathlib.PurePath` initializer.