]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-79634: Accept path-like objects as pathlib glob patterns. (#114017)
authorBarney Gale <barney.gale@gmail.com>
Sat, 20 Jan 2024 02:10:25 +0000 (02:10 +0000)
committerGitHub <noreply@github.com>
Sat, 20 Jan 2024 02:10:25 +0000 (02:10 +0000)
commit6313cdde58f34648a430d2830357c9d2a5b67b87
treeab329b153fb95322934d83eaf62b9a6749d0f09c
parent681e9e85a2c1f72576ddfbd766506e2d6db34862
GH-79634: Accept path-like objects as pathlib glob patterns. (#114017)

Allow `os.PathLike` objects to be passed as patterns to `pathlib.Path.glob()` and `rglob()`. (It's already possible to use them in `PurePath.match()`)

While we're in the area:

- Allow empty glob patterns in `PathBase` (but not `Path`)
- Speed up globbing in `PathBase` by generating paths with trailing slashes only as a final step, rather than for every intermediate directory.
- Simplify and speed up handling of rare patterns involving both `**` and `..` segments.
Doc/library/pathlib.rst
Lib/pathlib/__init__.py
Lib/pathlib/_abc.py
Lib/test/test_pathlib/test_pathlib.py
Lib/test/test_pathlib/test_pathlib_abc.py
Misc/NEWS.d/next/Library/2024-01-12-17-32-36.gh-issue-79634.uTSTRI.rst [new file with mode: 0644]