]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-44626, GH-105476: Fix `ntpath.isabs()` handling of part-absolute paths (#113829)
authorBarney Gale <barney.gale@gmail.com>
Sat, 13 Jan 2024 07:36:05 +0000 (07:36 +0000)
committerGitHub <noreply@github.com>
Sat, 13 Jan 2024 07:36:05 +0000 (07:36 +0000)
commite4ff131e01184b68d868cfd241a03f8b7d2e0ff9
tree0292c431d2dd38f47a265d1d25d961ef86ec43b7
parentdac1da21218a406652b35919aa2118cc32d4c65a
GH-44626, GH-105476: Fix `ntpath.isabs()` handling of part-absolute paths (#113829)

On Windows, `os.path.isabs()` now returns `False` when given a path that
starts with exactly one (back)slash. This is more compatible with other
functions in `os.path`, and with Microsoft's own documentation.

Also adjust `pathlib.PureWindowsPath.is_absolute()` to call
`ntpath.isabs()`, which corrects its handling of partial UNC/device paths
like `//foo`.

Co-authored-by: Jon Foster <jon@jon-foster.co.uk>
Doc/library/os.path.rst
Doc/whatsnew/3.13.rst
Lib/ntpath.py
Lib/pathlib/_abc.py
Lib/test/test_ntpath.py
Lib/test/test_pathlib/test_pathlib.py
Lib/test/test_unittest/test_program.py
Lib/test/test_zoneinfo/test_zoneinfo.py
Misc/NEWS.d/next/Tests/2024-01-08-21-15-48.gh-issue-44626.DRq-PR.rst [new file with mode: 0644]