diff options
author | Barney Gale <barney.gale@gmail.com> | 2024-01-26 01:12:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-26 01:12:46 (GMT) |
commit | b69548a0f52418b8a2cf7c7a885fdd7d3bfb1b0b (patch) | |
tree | 9f28d0deaeeb3d31f479cd31d255244ebd700f98 /Doc/installing | |
parent | 841eacd07646e643f87d7f063106633a25315910 (diff) | |
download | cpython-b69548a0f52418b8a2cf7c7a885fdd7d3bfb1b0b.zip cpython-b69548a0f52418b8a2cf7c7a885fdd7d3bfb1b0b.tar.gz cpython-b69548a0f52418b8a2cf7c7a885fdd7d3bfb1b0b.tar.bz2 |
GH-73435: Add `pathlib.PurePath.full_match()` (#114350)
In 49f90ba we added support for the recursive wildcard `**` in
`pathlib.PurePath.match()`. This should allow arbitrary prefix and suffix
matching, like `p.match('foo/**')` or `p.match('**/foo')`, but there's a
problem: for relative patterns only, `match()` implicitly inserts a `**`
token on the left hand side, causing all patterns to match from the right.
As a result, it's impossible to match relative patterns from the left:
`PurePath('foo/bar').match('bar/**')` is true!
This commit reverts the changes to `match()`, and instead adds a new
`full_match()` method that:
- Allows empty patterns
- Supports the recursive wildcard `**`
- Matches the *entire* path when given a relative pattern
Diffstat (limited to 'Doc/installing')
0 files changed, 0 insertions, 0 deletions