]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-106747: Make pathlib ABC globbing more consistent with `glob.glob()` (#115056)
authorBarney Gale <barney.gale@gmail.com>
Tue, 6 Feb 2024 02:48:18 +0000 (02:48 +0000)
committerGitHub <noreply@github.com>
Tue, 6 Feb 2024 02:48:18 +0000 (02:48 +0000)
commit1b1f8398d0ffe3c8ba2cca79d0c0f19a6a34e72a
treebb1cf363b3e007a040e2a1f55108bdd709bda4e9
parent299e16ca0f303a1e00bd0e04679862a5d4db5ab2
GH-106747: Make pathlib ABC globbing more consistent with `glob.glob()` (#115056)

When expanding `**` wildcards, ensure we add a trailing slash to the
topmost directory path. This matches `glob.glob()` behaviour:

    >>> glob.glob('dirA/**', recursive=True)
    ['dirA/', 'dirA/dirB', 'dirA/dirB/dirC']

This does not affect `pathlib.Path.glob()`, because trailing slashes aren't
supported in pathlib proper.
Lib/pathlib/_abc.py
Lib/test/test_pathlib/test_pathlib_abc.py