Skip to content

Commit abc4bd5

Browse files
authored
bpo-41611: IDLE: fix freezing on completion on macOS (GH-26400)
1 parent 8cec740 commit abc4bd5

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Lib/idlelib/autocomplete_w.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,13 @@ def winconfig_event(self, event):
247247
text.see(self.startindex)
248248
x, y, cx, cy = text.bbox(self.startindex)
249249
acw = self.autocompletewindow
250-
acw.update()
250+
if platform.system().startswith('Windows'):
251+
# On Windows an update() call is needed for the completion list
252+
# window to be created, so that we can fetch its width and
253+
# height. However, this is not needed on other platforms (tested
254+
# on Ubuntu and macOS) but at one point began causing freezes on
255+
# macOS. See issues 37849 and 41611.
256+
acw.update()
251257
acw_width, acw_height = acw.winfo_width(), acw.winfo_height()
252258
text_width, text_height = text.winfo_width(), text.winfo_height()
253259
new_x = text.winfo_rootx() + min(x, max(0, text_width - acw_width))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix IDLE sometimes freezing upon tab-completion on macOS.

0 commit comments

Comments
 (0)