Repository navigation
🐛 fix(cache): hash filesystem path bytes - #230
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DiskCache.py_info()encoded interpreter paths as strict UTF-8 before hashing them. A POSIX filename with an undecodable byte therefore raisedUnicodeEncodeErrorand stopped discovery even when the interpreter worked without a disk cache. The cache now hashes the path's filesystem bytes. Fixes #198.Filesystem path cache key
Python represents undecodable filename bytes with surrogateescape. Strict UTF-8 encoding rejected those surrogate characters.
os.fsencode()reverses the filesystem conversion, so the cache key can be computed for the original path bytes.Behavior changes
On POSIX, discovery can cache an interpreter whose path contains undecodable bytes. On Windows, the cache key continues to use UTF-8 path bytes.
Reported by Anthropic's OSS Scanner: ANT-2026-VPI28HMC.