Skip to content

pathlib ABCs: remove caching of path parser case sensitivity #130194

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
Feb 16, 2025

Conversation

barneygale
Copy link
Contributor

@barneygale barneygale commented Feb 16, 2025

Remove the caching _is_case_sensitive() function.

The cache used to speed up PurePath.[full_]match() and Path.[r]glob(), but that's no longer the case - these methods use self.parser is posixpath to determine case sensitivity.

This makes the pathlib._abc module a little easier to backport to Python 3.8, where functools.cache() is unavailable.

Remove the caching `_is_case_sensitive()` function. This makes the
`pathlib._abc` module a little easier to backport to Python 3.8, where
`functools.cache()` is unavailable.

This has no effect on `pathlib.PurePath` nor `Path`; these classes use
`self.parser is posixpath` to detect case sensitivity.
@barneygale barneygale merged commit 655fc8a into python:main Feb 16, 2025
46 checks passed
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