diff options
author | Barney Gale <barney.gale@gmail.com> | 2023-05-30 20:18:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-30 20:18:09 (GMT) |
commit | 49f90ba1eae56708b1894441418c13ad8e8ea9a8 (patch) | |
tree | 84113e0493e1d74e6f6dce582e827dc8a155540b /Misc/NEWS.d/next/Library | |
parent | 4c770617c0feae18ce3b05e0c8acd0910acc7082 (diff) | |
download | cpython-49f90ba1eae56708b1894441418c13ad8e8ea9a8.zip cpython-49f90ba1eae56708b1894441418c13ad8e8ea9a8.tar.gz cpython-49f90ba1eae56708b1894441418c13ad8e8ea9a8.tar.bz2 |
GH-73435: Implement recursive wildcards in `pathlib.PurePath.match()` (#101398)
`PurePath.match()` now handles the `**` wildcard as in `Path.glob()`, i.e. it matches any number of path segments.
We now compile a `re.Pattern` object for the entire pattern. This is made more difficult by `fnmatch` not treating directory separators as special when evaluating wildcards (`*`, `?`, etc), and so we arrange the path parts onto separate *lines* in a string, and ensure we don't set `re.DOTALL`.
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Diffstat (limited to 'Misc/NEWS.d/next/Library')
-rw-r--r-- | Misc/NEWS.d/next/Library/2023-02-17-18-56-46.gh-issue-73435.7sTJHk.rst | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2023-02-17-18-56-46.gh-issue-73435.7sTJHk.rst b/Misc/NEWS.d/next/Library/2023-02-17-18-56-46.gh-issue-73435.7sTJHk.rst new file mode 100644 index 0000000..d5a2ae0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-02-17-18-56-46.gh-issue-73435.7sTJHk.rst @@ -0,0 +1 @@ +Add support for recursive wildcards in :meth:`pathlib.PurePath.match`. |