You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Line-wrapped syntax highlighting in Python shell spills over into program output #152068
As shown here, when I make the input long enough that the range gets wrapped with a backtick, all subsequent lines until the next command prompt become the same cyan as the text of range.
Tangentially, is there any way to have Python itself stop doing this when the VScode terminal already did it for me in a way I find preferable (since it doesn't insert line-breaks into long one-liners copied from the shell)?
issue 140334 is similar, but this affects the shell, not just IDLE.
I was also struggling to replicate the issue. If the cursor jumps to the new line as you are typing, the ANSI escape sequence is added correctly. If you modify the inside, causing a keyword (not at cursor position) to be split, then the error occurs.
Activity
StanFromIreland commentedon Jun 24, 2026
I'm struggling to reproduce this issue:
edvilme commentedon Jun 24, 2026
This seems to me like an ANSI issue. Is this with the default Terminal.app or some other?
Edit: It appears the code explicitly singles out Terminal.app
cpython/Lib/_pyrepl/unix_console.py
Lines 215 to 218 in 6c3da17
and overrides the line wrapping
cpython/Lib/_pyrepl/unix_console.py
Lines 493 to 496 in 6c3da17
which could be causing the bug of the reset ANSI escape code not being appended properly to the second line.
edvilme commentedon Jun 25, 2026
I was also struggling to replicate the issue. If the cursor jumps to the new line as you are typing, the ANSI escape sequence is added correctly. If you modify the inside, causing a keyword (not at cursor position) to be split, then the error occurs.
StanFromIreland commentedon Jun 25, 2026
Thanks for the information. I'm not on a mac however, so I can't reproduce it anyway.
edvilme commentedon Jun 25, 2026
Ah that's right I forgot haha. It is a flaky use case but tried the fix and seems to work :)
Merge branch 'main' into pythongh-152068-pyrepl-color-bug
pythongh-152068: Test ANSI reset is emitted on console finish() and r…
gh-152068: Reset PyREPL Colors on prompt finish (#152108)
[3.15] gh-152068: Reset PyREPL Colors on prompt finish (GH-152108) (#…
pythongh-152068: Reset PyREPL Colors on prompt finish (python#152108)
Merge branch '3.14' into backport-pythongh-152068-pyrepl-color-bug
[3.14] gh-152068: Reset PyREPL Colors on prompt finish (GH-152108) (#…