]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-70303: Make `pathlib.Path.glob('**')` return both files and directories (#114684)
authorBarney Gale <barney.gale@gmail.com>
Tue, 30 Jan 2024 19:52:53 +0000 (19:52 +0000)
committerGitHub <noreply@github.com>
Tue, 30 Jan 2024 19:52:53 +0000 (19:52 +0000)
commitfda7445ca50b892955fc31bd72a3615fef1d70c6
tree37347a7623b016df6a24d390d0b4c7d6399baa9f
parent6de8aa31f39b3d8dbfba132e6649724eb07b8348
GH-70303: Make `pathlib.Path.glob('**')` return both files and directories (#114684)

Return files and directories from `pathlib.Path.glob()` if the pattern ends
with `**`. This is more compatible with `PurePath.full_match()` and with
other glob implementations such as bash and `glob.glob()`. Users can add a
trailing slash to match only directories.

In my previous patch I added a `FutureWarning` with the intention of fixing
this in Python 3.15. Upon further reflection I think this was an
unnecessarily cautious remedy to a clear bug.
Doc/library/pathlib.rst
Doc/whatsnew/3.13.rst
Lib/pathlib/__init__.py
Lib/test/test_pathlib/test_pathlib.py
Lib/test/test_pathlib/test_pathlib_abc.py
Misc/NEWS.d/next/Library/2024-01-28-18-38-18.gh-issue-70303._Lt_pj.rst [new file with mode: 0644]