python / python/cpython

Line-wrapped syntax highlighting in Python shell spills over into program output

Open
#152,068 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

OS-mac stdlib topic-repl type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Bug report

Bug description:

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.
Image
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.

CPython versions tested on:

3.14

Operating systems tested on:

macOS, in both VScode and the terminal.

Linked PRs
  • gh-152108
  • gh-153029
  • gh-154402

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the wrapped input in Python 3.14 using the macOS terminal and VS Code, then compare the behavior with issue 140334. Trace the Python shell's syntax-highlighting handling and verify that program output after a wrapped command no longer inherits the input color; linked PRs gh-152108, gh-153029, and gh-154402 indicate work is already underway.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.