]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-127381: pathlib ABCs: remove `case_sensitive` argument (#131024)
authorBarney Gale <barney.gale@gmail.com>
Mon, 10 Mar 2025 17:50:48 +0000 (17:50 +0000)
committerGitHub <noreply@github.com>
Mon, 10 Mar 2025 17:50:48 +0000 (17:50 +0000)
commit93fc3d34f9285d337c1e19e84764b02629eaab68
tree65861eaa604ea59cc6e3d934c5f79a13d2348475
parentc3487c941dfa252bde7e69f9d953d4ca9a56408d
GH-127381: pathlib ABCs: remove `case_sensitive` argument (#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.
Lib/pathlib/types.py
Lib/test/test_pathlib/test_join.py
Lib/test/test_pathlib/test_pathlib.py
Lib/test/test_pathlib/test_pathlib_abc.py