gh-140287: Handle PYTHONSTARTUP script exceptions in the asyncio REPL#140288
Open
johnslavik wants to merge 48 commits intopython:mainfrom
Open
gh-140287: Handle PYTHONSTARTUP script exceptions in the asyncio REPL#140288johnslavik wants to merge 48 commits intopython:mainfrom
PYTHONSTARTUP script exceptions in the asyncio REPL#140288johnslavik wants to merge 48 commits intopython:mainfrom
Conversation
Member
Author
|
Please merge #140298 first. |
johnslavik
commented
Oct 27, 2025
johnslavik
commented
Dec 20, 2025
Member
Author
|
I'll see if I can simplify this. I think the tests are slightly overcomplicated. |
johnslavik
commented
Dec 21, 2025
Member
Author
johnslavik
left a comment
There was a problem hiding this comment.
I'll come back to this after completing GH-140648.
Member
Author
|
I've realized that this isn't testing what it is supposed to test. I'll come back to this later. |
johnslavik
commented
Apr 1, 2026
Comment on lines
+71
to
+81
| @contextmanager | ||
| def new_pythonstartup_env(*, code: str, histfile: str = ".pythonhist"): | ||
| """Create environment variables for a PYTHONSTARTUP script in a temporary directory.""" | ||
| with os_helper.temp_dir() as tmpdir: | ||
| filename = os.path.join(tmpdir, "pythonstartup.py") | ||
| with open(filename, "w") as f: | ||
| f.write(code) | ||
| yield { | ||
| "PYTHONSTARTUP": filename, | ||
| "PYTHON_HISTORY": os.path.join(tmpdir, histfile) | ||
| } |
Member
Author
There was a problem hiding this comment.
This will be useful in #143023. I can inline it in test_pythonstartup_failure until then if we want to increase locality and not overdo idioms prematurely.
Member
Author
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.
This is generally a work in progress; tests are needed.
The asyncio patch is simple and ready.
PYTHONSTARTUPexceptions #140287