Skip to content

GH-129835: Yield path with trailing slash from ReadablePath.glob('') #129836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 8, 2025

Conversation

barneygale
Copy link
Contributor

@barneygale barneygale commented Feb 8, 2025

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.

…ob('')`

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.
@barneygale barneygale merged commit 707d066 into python:main Feb 8, 2025
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant