FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.12] GH-105113: Improve performance of `pathlib.PurePath.match()` by barneygale · Pull Request #105114 · python/cpython · GitHub

/ cpython Public

[3.12] GH-105113: Improve performance of pathlib.PurePath.match() - #105114

Merged
barneygale merged 1 commit into
python:3.12from
barneygale:gh-105113-3.12-match-perf
May 31, 2023
Merged

[3.12] GH-105113: Improve performance of pathlib.PurePath.match()#105114
barneygale merged 1 commit into
python:3.12from
barneygale:gh-105113-3.12-match-perf

Conversation

barneygale commented May 30, 2023
edited
Loading

Copy link
Copy Markdown
Contributor

We now compile an 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.

Partial backport of #101398 (excludes support for ** wildcards).


📚 Documentation preview 📚: https://cpython-previews--105114.org.readthedocs.build/

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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance or resource usage topic-pathlib

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL