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
IDLE applies syntax highlighting to user input in its shell #64007
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/terryjreedy'closed_at=Nonecreated_at=<Date2013-11-27.08:42:42.028>labels= ['expert-IDLE', 'type-bug', '3.7']
title='IDLE applies syntax highlighting to user input in its shell'updated_at=<Date2017-06-30.01:02:08.990>user='https://bugs.python.org/peterotten'
changed the title [-]IDLE applys syntax highlighting to user input in its shell[/-][+]IDLE applies syntax highlighting to user input in its shell[/+]on Nov 27, 2013
I checked and Idle does not color code the prompt. In 2.7, it only color-codes the response to input(prompt), which is eval-ed as Python code, but not the response to raw_input(prompt). (In 2.7, the code and input displayed raises SyntaxError.) So the bug in 3.3 and 3.4 is that 3.3 input is being treated like 2.7 input rather than like 2.7 raw_input.
I suspect that we just need to find and delete the code that detects 'input()' and triggers highlighting.
I think the prompt can easily be treated differently because it is written to stderr.
I don't see a difference for user input between input() and raw_input() on Linux with Python 2.7.2+ -- syntax-highlighting is applied to both.
On a freshly booted machine, I retried 2.7.6/Windows/raw_input() 'for all the' and indeed I now see 'for' and 'all' colored.
The colorizing is done char by char. 'fo' is black, 'for' turns orange, 'forr' turns black again. Similarly, 'al' is black, 'all is purple, and 'allo' is black again. It is not a critical bug, but certainly annoying, especially to a new user.
For editor windows, colorizing is only done for .py(wo) files. I do not know how the colorizing is switched on after the file name is checked. The shell window is an editor window. It should switch to .py mode after printing >>> and back to .txt mode when \n or \n\n is entered to complete a statement. I believe the edit will be in pyshell.py
I expect the prompt and echoed input are both written to stdout by the user process. Neither are errors and both are colored blue. Warnings and exception tracebacks on stderr are red. Both come into the idle process via the socket connection, which is different from the idle process stdin connected to the keyboard.
#157700 stops colorizing the text after the I/O mark while the Shell reads a line for input(). Output was never colorized; only the text typed after the last prompt was, whether it was code or a reply to input().
Activity
peterotten commentedon Nov 27, 2013
For example when you type
in its shell window IDLE shows the 'for' as if it were a keyword. The same happens if you run a script that requires user interaction.
[-]IDLE applys syntax highlighting to user input in its shell[/-][+]IDLE applies syntax highlighting to user input in its shell[/+]terryjreedy commentedon Nov 30, 2013
I checked and Idle does not color code the prompt. In 2.7, it only color-codes the response to input(prompt), which is eval-ed as Python code, but not the response to raw_input(prompt). (In 2.7, the code and input displayed raises SyntaxError.) So the bug in 3.3 and 3.4 is that 3.3 input is being treated like 2.7 input rather than like 2.7 raw_input.
I suspect that we just need to find and delete the code that detects 'input()' and triggers highlighting.
peterotten commentedon Nov 30, 2013
I think the prompt can easily be treated differently because it is written to stderr.
I don't see a difference for user input between input() and raw_input() on Linux with Python 2.7.2+ -- syntax-highlighting is applied to both.
terryjreedy commentedon Nov 30, 2013
On a freshly booted machine, I retried 2.7.6/Windows/raw_input() 'for all the' and indeed I now see 'for' and 'all' colored.
The colorizing is done char by char. 'fo' is black, 'for' turns orange, 'forr' turns black again. Similarly, 'al' is black, 'all is purple, and 'allo' is black again. It is not a critical bug, but certainly annoying, especially to a new user.
I expect the prompt and echoed input are both written to stdout by the user process. Neither are errors and both are colored blue. Warnings and exception tracebacks on stderr are red. Both come into the idle process via the socket connection, which is different from the idle process stdin connected to the keyboard.
terryjreedy commentedon Jun 30, 2017
Still a problem in 3.6.
serhiy-storchaka commentedon Sep 17, 2026
#157700 stops colorizing the text after the I/O mark while the Shell reads a line for
input(). Output was never colorized; only the text typed after the last prompt was, whether it was code or a reply toinput().Merge branch 'main' into pythongh-64007-input-colors
gh-64007: Do not colorize response to input() in the IDLE Shell (#157700
[3.13] gh-64007: Do not colorize response to input() in the IDLE Shell (
[3.14] gh-64007: Do not colorize response to input() in the IDLE Shell (
terryjreedy commentedon Sep 27, 2026
3.15 backport must be generated after prior 3.15 backports are merged after 3.15 branch is unblocked.
[3.15] gh-64007: Do not colorize response to input() in the IDLE Shell (