Skip to content

Commit

Permalink
pythongh-127060: Disable traceback colors in IDLE (python#128028)
Browse files Browse the repository at this point in the history
Set TERM environment variable to "dumb" to disable traceback colors
in IDLE, since IDLE doesn't understand ANSI escape sequences.
  • Loading branch information
vstinner authored Dec 18, 2024
1 parent b92f101 commit 559b0e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Lib/idlelib/pyshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,9 @@ def __init__(self, tkconsole):
def spawn_subprocess(self):
if self.subprocess_arglist is None:
self.subprocess_arglist = self.build_subprocess_arglist()
self.rpcsubproc = subprocess.Popen(self.subprocess_arglist)
# gh-127060: Disable traceback colors
env = dict(os.environ, TERM='dumb')
self.rpcsubproc = subprocess.Popen(self.subprocess_arglist, env=env)

def build_subprocess_arglist(self):
assert (self.port!=0), (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Set TERM environment variable to "dumb" to disable traceback colors in IDLE,
since IDLE doesn't understand ANSI escape sequences. Patch by Victor Stinner.

0 comments on commit 559b0e7

Please sign in to comment.