]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-127060: Disable traceback colors in IDLE (GH-128028) (#128052)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 18 Dec 2024 05:58:57 +0000 (06:58 +0100)
committerGitHub <noreply@github.com>
Wed, 18 Dec 2024 05:58:57 +0000 (05:58 +0000)
Set TERM environment variable to "dumb" to disable traceback colors
in IDLE, since IDLE doesn't understand ANSI escape sequences.

(cherry picked from commit 559b0e7013f9cbf42a12fe9c86048d5cbb2f6f22)

Co-authored-by: Victor Stinner <vstinner@python.org>
Lib/idlelib/pyshell.py
Misc/NEWS.d/next/Library/2024-12-17-13-21-52.gh-issue-127060.mv2bX6.rst [new file with mode: 0644]

index e882c6cb3b8d19cdfa4491fe9fc0938dc7d2a186..66fbbd4a97b7af4288266fdb1695c6efbade35c8 100755 (executable)
@@ -424,7 +424,9 @@ class ModifiedInterpreter(InteractiveInterpreter):
     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), (
diff --git a/Misc/NEWS.d/next/Library/2024-12-17-13-21-52.gh-issue-127060.mv2bX6.rst b/Misc/NEWS.d/next/Library/2024-12-17-13-21-52.gh-issue-127060.mv2bX6.rst
new file mode 100644 (file)
index 0000000..1da89e7
--- /dev/null
@@ -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.