GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-160900: support path-like objects in fnmatch filters by MonikaDvorackova · Pull Request #160980 · python/cpython Conversation
|
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Thank you for the review. I've addressed the requested changes:
The list comprehension was consistently the fastest, reducing execution time by approximately 18–21% compared with the previous implementation. I've updated All 26 The benchmark results are preliminary measurements from a CPython 3.16 debug build using |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Documentation build overview
81 files changed ·
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Please don't. Use a release build or one with a |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Thanks for the review. I've pushed the documentation updates and added I also reran the performance comparison using a CPython 3.16 release build rather than a debug build. The benchmark compares three implementations:
The input consists of filename strings matched against Selected results:
The list comprehension was faster than the lambda-based implementation in 11 of the 12 tested scenarios. However, some measurements showed substantial variability, so these results should be treated as preliminary rather than definitive. I haven't yet reproduced the benchmark scripts from the original |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Please don't use an LLM to post your comments. I don't want to communicate with an agent only. YOur comments are not edited at since the markdown contains the HTML itself. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Please avoid updating the branches when there is nothing that has changed. It wastes CI resources. Read https://devguide.python.org/getting-started/pull-request-lifecycle/#update-branch-button |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ok. Thanks for the review. I've addressed the feedback, including the documentation changes and the mixed bytes/str/path-like regression tests. The latest CI run has completed, with all 51 technical checks passing across the supported platforms. I also wanted to clarify the earlier branch update: it was intended to retry the macOS CI job after the runner lost communication. I'll avoid unnecessary branch updates going forward. The PR should now be ready for another review. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I pushed the requested changes in b55db66, including the list comprehension in filter(), and resolved the addressed review threads. Tests, lint, and the documentation preview have all passed. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ok, sorry I misunderstood. I restored the original POSIX optimization in filter() while retaining PathLike support through os.fspath(). All 28 test_fnmatch tests pass locally. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
No, the change in filtrr was right. I did not want to change it to a list comprehension unless it is faster. That was the only comment. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
…07288.rst Co-authored-by: Bénédikt Tran <[email protected]>
| return result | ||
| return [ | ||
| name for name in names | ||
| if match(os.path.normcase(os.fspath(name))) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
is there a need to call os.fspath?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I thought that os.path.normcase already called os.fspath
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
You're right, os.path.normcase() already calls os.fspath() on POSIX and Windows. I've removed the redundant calls from both filter() and filterfalse() in 584ec30. test_fnmatch passes locally. Thanks for catching this.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
fnmatch.filter and filterfalse work with pathlikes only on non-Posix platforms
There was an error while loading. Please reload this page.