Repository navigation
🐛 fix(create): drop PYTHONPATH from the debug interpreter - #3474
Merged
Merged
Conversation
Annotate the fixtures, mark the locals Final and create the session right before the assertion that reads it.
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.
virtualenv collects the target environment's debug information (the
target debugsection ofvirtualenv -vvandCreator.debug) by running the new interpreter. It built a copy of the environment withoutPYTHONPATHfor that run but then never passed it, so the child inherited the caller's full environment. 🐛 The reportedsys.pathlisted the caller'sPYTHONPATHentries, and theenvgiven tocli_runhad no effect on this process. After this change the debug interpreter runs with the filtered copy of the environment given to the creator.The shared subprocess helper accepts an optional environment and forwards it to the child. Every other caller still inherits the process environment.
The debug interpreter now sees only the variables in the environment given to the creator, minus
PYTHONPATH. Whencli_runreceives a customenv, that mapping now reaches this process too.Thanks for contributing, make sure you address all the checklists (for details on how see development documentation)
ran the linter to address style issues (
tox -e fix) (ruff, typos and ty on the changed files)wrote descriptive pull request text
ensured there are test(s) validating the fix
added a
docs/changelog/+short-description.<type>.rstfragment for each user-facing change, or appliedskip newsupdated/extended the documentation (not needed, no documented behavior changes)
for changes to activation scripts,
pyvenv.cfg, wheel downloads, app-data or release workflows: explained in the PR text which outside input the change handles, such as a path, a prompt or a downloaded file, and how it stops that input from running as code. See the security scope. (not applicable)ran tests on Python 3.9 and 3.15 (
tox run -e 3.9,3.15) (ran on 3.12; CI covers the matrix)linked upstream issues beside any temporary interpreter overrides (not applicable)
kept the PR in draft until CI passes
Fixes #3473