Skip to content

Commit f8b4e20

Browse files
[3.13] gh-127060: Disable traceback colors in IDLE (GH-128028) (#128052)
Set TERM environment variable to "dumb" to disable traceback colors in IDLE, since IDLE doesn't understand ANSI escape sequences. (cherry picked from commit 559b0e7) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent fe08cdf commit f8b4e20

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Lib/idlelib/pyshell.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,9 @@ def __init__(self, tkconsole):
424424
def spawn_subprocess(self):
425425
if self.subprocess_arglist is None:
426426
self.subprocess_arglist = self.build_subprocess_arglist()
427-
self.rpcsubproc = subprocess.Popen(self.subprocess_arglist)
427+
# gh-127060: Disable traceback colors
428+
env = dict(os.environ, TERM='dumb')
429+
self.rpcsubproc = subprocess.Popen(self.subprocess_arglist, env=env)
428430

429431
def build_subprocess_arglist(self):
430432
assert (self.port!=0), (
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Set TERM environment variable to "dumb" to disable traceback colors in IDLE,
2+
since IDLE doesn't understand ANSI escape sequences. Patch by Victor Stinner.

0 commit comments

Comments
 (0)