Skip to content

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

Merged
barneygale merged 1 commit into
python:mainfrom
barneygale:pathlib-abc-drop-functools
Feb 16, 2025
Merged

pathlib ABCs: remove caching of path parser case sensitivity#130194
barneygale merged 1 commit into
python:mainfrom
barneygale:pathlib-abc-drop-functools

Conversation

@barneygale

@barneygale barneygale commented Feb 16, 2025

Copy link
Copy Markdown
Contributor

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.
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