]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-129835: Yield path with trailing slash from `ReadablePath.glob('')` (#129836)
authorBarney Gale <barney.gale@gmail.com>
Sat, 8 Feb 2025 06:47:09 +0000 (06:47 +0000)
committerGitHub <noreply@github.com>
Sat, 8 Feb 2025 06:47:09 +0000 (06:47 +0000)
commit707d066193c26ab66c8e5e45e72c3a37f48daf45
treeb238da2d9e92e03375d722f2cedf1078c8b3b3c5
parent6c67904e793828d84716a8c83436c9495235f3a1
GH-129835: Yield path with trailing slash from `ReadablePath.glob('')` (#129836)

In the private pathlib ABCs, make `ReadablePath.glob('')` yield a path with
a trailing slash (if it yields anything at all). As a result, `glob()`
works similarly to `joinpath()` when given a non-magic pattern.

In the globbing implementation, we preemptively add trailing slashes to
intermediate paths if there are pattern parts remaining; this removes the
need to check for existing trailing slashes (in the removed `add_slash()`
method) at subsequent steps.
Lib/glob.py
Lib/pathlib/_abc.py
Lib/pathlib/_local.py
Lib/test/test_pathlib/test_pathlib_abc.py