Conversation
…REPL use Users may be able to assign non-string, but string representable values to ps1, but these should be converted to their string representations before use by PyREPL rendering.
sys.ps1 and sys.ps2 to strings before PyREPL usesys.ps1 and sys.ps2 to strings before PyREPL use
sys.ps1 and sys.ps2 to strings before PyREPL usesys.ps1 and sys.ps2 to strings before PyREPL use
sys.ps1 and sys.ps2 to strings before PyREPL usesys.ps1 and sys.ps2 to strings before PyREPL use
Contributor
|
It would be good to fix original issue as well. |
brettcannon
reviewed
Oct 5, 2026
…ibO9V.rst Co-authored-by: Brett Cannon <brett@python.org>
edvilme
added a commit
to microsoft/vscode-python
that referenced
this pull request
Oct 5, 2026
Improve the integration of prompt handling in the REPL, ensuring that prompts are always passed as strings to `_pyrepl.simple_interact.multiline_input` * In `python_files/pythonrc.py`, patch `_pyrepl.simple_interact.multiline_input` so that the `ps1` and `ps2` prompt arguments are always converted to strings before being passed, preventing issues with non-string prompt objects (see python/cpython#158828) ### Testing * Adds a new test `test_pyrepl_multiline_input_converts_prompts_to_strings` in `python_files/tests/test_shell_integration.py` to verify that the patched `multiline_input` function correctly converts prompt arguments to strings before calling the original 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.
Users may be able to assign non-string, but string representable values to
sys.ps1orsys.ps2, but these should be converted to their string representations before use by PyREPL rendering.Otherwise, for users assigning non-string objects, or using tools like VSCode, the REPL overflows with errors.
sys.ps1is not a string #158827