Repository navigation
Preserve isolated sys.path on Python 3.10 - #2211
Merged
Merged
Conversation
Member
|
Thanks for all the pull requests. Do you do Discord? I'd like to talk to you: #coverage-py channel. About this pull request: this seems to only be needed on 3.10, which is going out of support in October. Can we mark this code so that it can be removed then? In general: what can I do in the coverage repo so that the LLMs will learn the right way to run tests? All of these pull requests have long bullet lists of elaborate commands when |
itscloud0
marked this pull request as ready for review
June 29, 2026 15:54
Member
|
This is now released as part of coverage 7.15.0. |
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.
Summary
sys.pathhandling inPyRunner.prepare()even on Python versions withoutsys.flags.safe_pathpython -I run_me.pywithpython -Im coverage run run_me.pyProblem
Fixes #2103.
On Python 3.10,
python -Im coverage run poc.pywas re-inserting the working directory atsys.path[0], unlike plainpython -I poc.py. That also displaced the interpreter's normal isolated-mode zip entry.Solution
Honor
sys.flags.isolatedalongsidesys.flags.safe_pathso isolated-mode runs keep the same path layout that plain Python uses.