Skip to content

Commit dbcae90

Browse files
miss-islingtonserhiy-storchakaarobergeclaude
authored
[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 2483fb3) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: André Roberge <andre.roberge@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 601d2d9 commit dbcae90

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

‎Lib/idlelib/pyshell.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,8 @@ def execfile(self, filename, source=None):
705705

706706
def runsource(self, source):
707707
"Extend base class method: Stuff the source in the line cache first"
708+
# Remove the highlighting of a previous syntax error (gh-93966).
709+
self.tkconsole.text.tag_remove("ERROR", "1.0", "end")
708710
filename = self.stuffsource(source)
709711
# at the moment, InteractiveInterpreter expects str
710712
assert isinstance(source, str)
@@ -741,7 +743,6 @@ def showsyntaxerror(self, filename=None, **kwargs):
741743
"""
742744
tkconsole = self.tkconsole
743745
text = tkconsole.text
744-
text.tag_remove("ERROR", "1.0", "end")
745746
type, value, tb = sys.exc_info()
746747
if not issubclass(type, SyntaxError):
747748
tkconsole.resetoutput()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The highlighting of a syntax error in the IDLE Shell is now removed when the
2+
next statement is entered, not only when the next syntax error occurs.

0 commit comments

Comments
 (0)