Repository navigation
🐛 fix(cache): key interpreter caches on absolute paths - #296
Merged
Merged
Conversation
Path.absolute anchors a relative executable at the working directory without the ".." collapsing of os.path.abspath, which can step out of a symlinked directory, and needs no lint suppression. The tests build both virtual environments in one venv call, compare their results in one assert, and no longer patch the private query function.
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.
PythonInfo.from_exekeyed its in-memory and disk caches on the executable path as given. A relative path such asvenv/bin/pythontherefore hit the entry stored from another working directory and returned that directory's interpreter. The disk cache made the same mistake whenever the two executables had the same modification time, as POSIX virtual environments symlinking one system Python do. Separately, a lookup through another spelling of a cached path, such asbin/./python, which the key treats as the same path becausepathlibdrops.segments, overwroteexecutableon the shared cached object, which changedPythonInfo.current()and every result returned earlier.🐛 The cache key is now the path made absolute against the current working directory, without resolving symlinks or collapsing
.., so distinct virtual environments keep distinct entries. When the requested spelling differs from the cached one, the result is a copy carrying the requestedexecutable, asresolve_to_systemalready returns.