https://github.com/python/cpython/commit/dbcae904c68b211b13b21b002628bbae27e66587
commit: dbcae904c68b211b13b21b002628bbae27e66587
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: terryjreedy <[email protected]>
date: 2026-09-24T05:43:18Z
summary:

[3.14] gh-93966: Remove the syntax error highlighting in the IDLE Shell on the 
next statement (GH-157595) (#158058)

gh-93966: Remove the syntax error highlighting in the IDLE Shell on the next 
statement (GH-157595)

It stayed until the next syntax error.
(cherry picked from commit 2483fb32062b99624303f6c203d5cbdba1de7cb3)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: AndrĂ© Roberge <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>

files:
A Misc/NEWS.d/next/IDLE/2026-09-15-22-10-17.gh-issue-93966.ch4fTB.rst
M Lib/idlelib/pyshell.py

diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py
index 19a6569ac61182..1aeabba0a728fe 100755
--- a/Lib/idlelib/pyshell.py
+++ b/Lib/idlelib/pyshell.py
@@ -705,6 +705,8 @@ def execfile(self, filename, source=None):
 
     def runsource(self, source):
         "Extend base class method: Stuff the source in the line cache first"
+        # Remove the highlighting of a previous syntax error (gh-93966).
+        self.tkconsole.text.tag_remove("ERROR", "1.0", "end")
         filename = self.stuffsource(source)
         # at the moment, InteractiveInterpreter expects str
         assert isinstance(source, str)
@@ -741,7 +743,6 @@ def showsyntaxerror(self, filename=None, **kwargs):
         """
         tkconsole = self.tkconsole
         text = tkconsole.text
-        text.tag_remove("ERROR", "1.0", "end")
         type, value, tb = sys.exc_info()
         if not issubclass(type, SyntaxError):
             tkconsole.resetoutput()
diff --git 
a/Misc/NEWS.d/next/IDLE/2026-09-15-22-10-17.gh-issue-93966.ch4fTB.rst 
b/Misc/NEWS.d/next/IDLE/2026-09-15-22-10-17.gh-issue-93966.ch4fTB.rst
new file mode 100644
index 00000000000000..3260b42211b780
--- /dev/null
+++ b/Misc/NEWS.d/next/IDLE/2026-09-15-22-10-17.gh-issue-93966.ch4fTB.rst
@@ -0,0 +1,2 @@
+The highlighting of a syntax error in the IDLE Shell is now removed when the
+next statement is entered, not only when the next syntax error occurs.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to