Skip to content

Commit b845c02

Browse files
miss-islingtonserhiy-storchakaarobergeclaude
authored
[3.15] gh-93966: Remove the syntax error highlighting in the IDLE Shell on the next statement (GH-157595) (#158057)
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 2e22d0a commit b845c02

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
@@ -694,6 +694,8 @@ def execfile(self, filename, source=None):
694694

695695
def runsource(self, source):
696696
"Extend base class method: Stuff the source in the line cache first"
697+
# Remove the highlighting of a previous syntax error (gh-93966).
698+
self.tkconsole.text.tag_remove("ERROR", "1.0", "end")
697699
filename = self.stuffsource(source)
698700
# at the moment, InteractiveInterpreter expects str
699701
assert isinstance(source, str)
@@ -730,7 +732,6 @@ def showsyntaxerror(self, filename=None, **kwargs):
730732
"""
731733
tkconsole = self.tkconsole
732734
text = tkconsole.text
733-
text.tag_remove("ERROR", "1.0", "end")
734735
type, value, tb = sys.exc_info()
735736
msg = getattr(value, 'msg', '') or value or "<no detail available>"
736737
lineno = getattr(value, 'lineno', '') or 1
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)