Skip to content
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

GH-106330: Fix matching of empty path in pathlib.PurePath.match() #106331

Merged
merged 2 commits into from
Jul 3, 2023

Conversation

barneygale
Copy link
Contributor

@barneygale barneygale commented Jul 2, 2023

We match paths using the _lines attribute, which is derived from the path's string representation. The bug arises because an empty path's string representation is '.' (not ''), which is matched by the '*' wildcard.

…h()`

We match paths using the `_lines` attribute, which is derived from the
path's string representation. The bug arises because an empty path's string
representation is `'.'` (not `''`), which is matched by the `'*'` wildcard.
@barneygale barneygale requested a review from zooba July 3, 2023 19:36
@barneygale
Copy link
Contributor Author

@zooba I've requested your review as this relates back to #101398. Thank you for your consideration :]

@barneygale
Copy link
Contributor Author

Thanks v much Steve!

@barneygale barneygale merged commit b4efdf8 into python:main Jul 3, 2023
@miss-islington
Copy link
Contributor

Thanks @barneygale for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@miss-islington
Copy link
Contributor

Sorry @barneygale, I had trouble checking out the 3.12 backport branch.
Please retry by removing and re-adding the "needs backport to 3.12" label.
Alternatively, you can backport using cherry_picker on the command line.
cherry_picker b4efdf8cda8fbbd0ca53b457d5f6e46a59348caf 3.12

barneygale added a commit to barneygale/cpython that referenced this pull request Jul 3, 2023
…th.match()` (pythonGH-106331)

We match paths using the `_lines` attribute, which is derived from the
path's string representation. The bug arises because an empty path's string
representation is `'.'` (not `''`), which is matched by the `'*'` wildcard.
(cherry picked from commit b4efdf8)

Co-authored-by: Barney Gale <[email protected]>
@bedevere-bot
Copy link

GH-106372 is a backport of this pull request to the 3.12 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.12 bug and security fixes label Jul 3, 2023
barneygale added a commit that referenced this pull request Jul 4, 2023
…ch()` (GH-106331) (GH-106372)

We match paths using the `_lines` attribute, which is derived from the
path's string representation. The bug arises because an empty path's string
representation is `'.'` (not `''`), which is matched by the `'*'` wildcard.
(cherry picked from commit b4efdf8)
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.

4 participants