Repository navigation
fix(cache): discard unusable interpreter cache entries - #141
Merged
gaborbernat merged 4 commits intoOct 10, 2026
Merged
Conversation
DiskCache.read() already drops a py_info cache file that fails to parse, but valid JSON of the wrong shape got through. A list, string, number or boolean at the top level reached _read_cache_entry, whose data.get() raised AttributeError. A content mapping with no system_executable did the same, and a non-path one (an int, a list) made Path() raise TypeError. Nothing above caught either, so a single damaged file under the cache failed every interpreter lookup that hit it. virtualenv, for one, stops creating environments until someone deletes the file. Treat any of these the way a file that fails to parse is treated: remove it and query the interpreter again. That matches what _load_cached_py_info already did for a bad version_info.
Cached directories and empty paths interrupt host resolution. Treat them and filesystem lookup errors as stale entries, then query the interpreter again. Verify cache recovery through the public API with real files.
gaborbernat
enabled auto-merge (squash)
October 10, 2026 00:52
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.

Valid JSON cache files can contain a top-level list, string, number or boolean. Missing or invalid
system_executablefields also interrupt interpreter discovery.Discard those entries and query the interpreter again. Require any non-null
system_executableto name a regular file, and treat filesystem lookup errors as stale cache entries.