Thanks to visit codestin.com
Credit goes to github.com

Skip to content

GH-127381: pathlib ABCs: remove case_sensitive argument #131024

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

Merged
merged 1 commit into from
Mar 10, 2025

Conversation

barneygale
Copy link
Contributor

@barneygale barneygale commented Mar 9, 2025

Remove the case_sensitive argument from _JoinablePath.full_match() and _ReadablePath.glob(). Using a non-native case sensitivity forces the use of "case-pedantic" globbing, where we iterdir() even for non-wildcard pattern segments. But it's hard to know when to enable this mode, as case-sensitivity can vary by directory, so _PathParser.normcase() doesn't always give the full picture. The Path.glob() implementation is forced to make an educated guess, but we can avoid the issue in the ABCs by dropping the case_sensitive argument.

(I probably shouldn't have added this argument in Path.glob() in the first place!)

Also drop support for _ReadablePath.glob(recurse_symlinks=False), which makes recursive globbing much slower.

No change to the public pathlib classes.

Remove the *case_sensitive* argument from `_JoinablePath.full_match()` and
`_ReadablePath.glob()`. Using a non-native case sensitivity forces the use
of "case-pedantic" globbing, where we `iterdir()` even for non-wildcard
pattern segments. But it's hard to know when to enable this mode, as
case-sensitivity can vary by directory, so `_PathParser.normcase()` doesn't
always give the full picture. The `Path.glob()` implementation is forced to
make an educated guess, but we can avoid the issue in the ABCs by dropping
the *case_sensitive* argument.

(I probably shouldn't have added these arguments in `PurePath` and `Path`
in the first place!)

Also drop support for `_ReadablePath.glob(recurse_symlinks=False)`, which
makes recursive globbing much slower.
@barneygale barneygale merged commit 93fc3d3 into python:main Mar 10, 2025
44 checks passed
seehwan pushed a commit to seehwan/cpython that referenced this pull request Apr 16, 2025
…on#131024)

Remove the *case_sensitive* argument from `_JoinablePath.full_match()` and
`_ReadablePath.glob()`. Using a non-native case sensitivity forces the use
of "case-pedantic" globbing, where we `iterdir()` even for non-wildcard
pattern segments. But it's hard to know when to enable this mode, as
case-sensitivity can vary by directory, so `_PathParser.normcase()` doesn't
always give the full picture. The `Path.glob()` implementation is forced to
make an educated guess, but we can avoid the issue in the ABCs by dropping
the *case_sensitive* argument.

(I probably shouldn't have added these arguments in `PurePath` and `Path`
in the first place!)

Also drop support for `_ReadablePath.glob(recurse_symlinks=False)`, which
makes recursive globbing much slower.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant