Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
gh-123135: add support for path-like objects infnmatch.filter on POSIX platforms#123122
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
gh-123135: add support for path-like objects infnmatch.filter on POSIX platforms#123122
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Users might already expect that
And the
And the
So I think we should fix the discrepancy and explicitly support path-likenames. |
Let's fix it then. I think I'll make it a bugfix rather than a feature. |
fnmatch.filter behavioursfnmatch.filterSeepythongh-123122 for the rationale.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Looking good. It's worth a.. versionchanged:: directive in the docs to point out that path-like support was added in 3.14, and that in previous versions it only worked on Windows.
Uh oh!
There was an error while loading.Please reload this page.
Misc/NEWS.d/next/Library/2024-08-19-09-36-50.gh-issue-123135.w_ZNAs.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
picnixz commentedAug 21, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I have made the requested changes; please review again. By the way, I'm wondering whether we should explicitly call def fnmatchcase(name, pat): """Test whether FILENAME matches PATTERN, including case. This is a version of fnmatch() which doesn't case-normalize its arguments. """ match = _compile_pattern(pat)- return match(name) is not None+ return match(os.fspath(name)) is not None |
Thanks for making the requested changes! @barneygale: please review the changes made to this pull request. |
fnmatch.filterfnmatch.filter on POSIX platforms| @@ -0,0 +1,3 @@ | |||
| Added support for supplying:term:`path-like objects <path-like object>` | |||
| to the *names* parameter of:func:`fnmatch.filter`. Previously, such | |||
| objects were only accepted on non-POSIX platforms. Patch by Bénédikt Tran. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The only non-POSIX platform that we support is Windows:
| objects were only accepted onnon-POSIX platforms. Patch by Bénédikt Tran. | |
| objects were only accepted onWindows. Patch by Bénédikt Tran. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
What about WASI?
Uh oh!
There was an error while loading.Please reload this page.
That sounds reasonable to me! |
See#123215 (comment) for the rationale of marking it as DO-NOT-MERGE for now. |
See#123215 (comment) for the rationale of closing this PR. |
Uh oh!
There was an error while loading.Please reload this page.
This fixes an inconsistency in the
fnmatchmodule where path-like objects are allowed on Windows but not on POSIX platforms.cc@barneygale since you were recently interested in
fnmatch!fnmatch.filteron POSIX platforms #123135