-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add case_sensitive argument to pathlib.PurePath.match()
#104484
Comments
I'd like to land #101398 before I start work on this. |
Hi @barneygale, |
@barneygale kindly review this PR |
…H-104565) Co-authored-by: Barney Gale <barney.gale@gmail.com>
Added in #104565 / dcdc90d. Thank you, @thirumurugan-git! |
* main: pythongh-74690: Don't set special protocol attributes on non-protocol subclasses of protocols (python#104622) pythongh-104623: Update Windows installer to use SQLite 3.42.0 (python#104625) pythongh-104050: Add more type annotations to Argument Clinic (python#104628) pythongh-104629: Don't skip test_clinic if _testclinic is missing (python#104630) pythongh-104549: Set __module__ on TypeAliasType (python#104550) pythongh-104050: Improve some typing around `default`s and sentinel values (python#104626) pythongh-104146: Remove unused vars from Argument Clinic (python#104627) pythongh-104615: don't make unsafe swaps in apply_static_swaps (python#104620) pythonGH-104484: Add case_sensitive argument to `pathlib.PurePath.match()` (pythonGH-104565) pythonGH-96803: Document and test new unstable internal frame API functions (pythonGH-104211) pythonGH-104580: Don't cache eval breaker in interpreter (pythonGH-104581)
It should be noted in the docs that |
It used Lines 189 to 190 in d1bfefd
|
I lost track of changes in 3.12. I thought it always used |
Here's a table showing how
You can see that things were already inconsistent in 3.11. For 3.12, we've:
I wouldn't mind changing |
AFAIK, On Windows, Given that any tree in a Linux ext4 filesystem can be made case insensitive, and any tree in a Windows NTFS filesystem can be made case sensitive (even a non-empty directory if the registry setting allows it), I'd prefer for a platform-dependent comparison to support partially realized behavior in this regard. Maybe the |
Thank you Eryk. I've logged a new issue here: #104947. Will get it fixed pronto!
Seemingly not in all circumstances: >>> s = 'ı'
>>> t = 'i'
>>> s.lower() == t.lower()
False
>>> import re
>>> re.match(s, t, flags=re.IGNORECASE)
<re.Match object; span=(0, 1), match='i'>
This is on my to-do list :) |
Re-resolving this ticket per the above. |
In #81079 we added a case_sensitive argument to
pathlib.Path.glob()
andrglob()
. It would be good to have this functionality available in the closely-relatedPurePath.match()
method. The rationale is much the same: this argument is useful when dealing with case-sensitive filesystems on Windows, and case-insensitive filesystems on Posix. Also, it would allow this method to be used fromglob()
to implement recursive globbing efficiently, which is important for #102613.Linked PRs
The text was updated successfully, but these errors were encountered: