Skip to content

Commit bfdeaa3

Browse files
ZackerySpytzterryjreedytaleinat
authored
bpo-38792: Remove IDLE shell calltip before new prompt. (#17150)
Previously, a calltip might be left after SyntaxError, KeyboardInterrupt, or Shell Restart. Co-authored-by: Terry Jan Reedy <[email protected]> Co-authored-by: Tal Einat <[email protected]>
1 parent 46874c2 commit bfdeaa3

File tree

5 files changed

+9
-3
lines changed

5 files changed

+9
-3
lines changed

Lib/idlelib/NEWS.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Released on 2020-10-05?
33
======================================
44

55

6+
bpo-38792: Close a shell calltip if a :exc:`KeyboardInterrupt`
7+
or shell restart occurs. Patch by Zackery Spytz.
8+
69
bpo-30780: Add remaining configdialog tests for buttons and
710
highlights and keys tabs.
811

Lib/idlelib/calltip.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def _make_tk_calltip_window(self):
3333
# See __init__ for usage
3434
return calltip_w.CalltipWindow(self.text)
3535

36-
def _remove_calltip_window(self, event=None):
36+
def remove_calltip_window(self, event=None):
3737
if self.active_calltip:
3838
self.active_calltip.hidetip()
3939
self.active_calltip = None
@@ -55,7 +55,7 @@ def refresh_calltip_event(self, event):
5555
self.open_calltip(False)
5656

5757
def open_calltip(self, evalfuncs):
58-
self._remove_calltip_window()
58+
self.remove_calltip_window()
5959

6060
hp = HyperParser(self.editwin, "insert")
6161
sur_paren = hp.get_surrounding_brackets('(')

Lib/idlelib/editor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def __init__(self, flist=None, filename=None, key=None, root=None):
328328
text.bind("<<run-module>>", scriptbinding.run_module_event)
329329
text.bind("<<run-custom>>", scriptbinding.run_custom_event)
330330
text.bind("<<do-rstrip>>", self.Rstrip(self).do_rstrip)
331-
ctip = self.Calltip(self)
331+
self.ctip = ctip = self.Calltip(self)
332332
text.bind("<<try-open-calltip>>", ctip.try_open_calltip_event)
333333
#refresh-calltip must come after paren-closed to work right
334334
text.bind("<<refresh-calltip>>", ctip.refresh_calltip_event)

Lib/idlelib/pyshell.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,7 @@ def resetoutput(self):
12921292
self.text.insert("end-1c", "\n")
12931293
self.text.mark_set("iomark", "end-1c")
12941294
self.set_line_and_column()
1295+
self.ctip.remove_calltip_window()
12951296

12961297
def write(self, s, tags=()):
12971298
try:
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Close an IDLE shell calltip if a :exc:`KeyboardInterrupt`
2+
or shell restart occurs. Patch by Zackery Spytz.

0 commit comments

Comments
 (0)