Skip to content

Commit 65fb9a2

Browse files
bpo-41611: IDLE: fix freezing on completion on macOS (GH-26400)
(cherry picked from commit abc4bd5) Co-authored-by: Tal Einat <[email protected]>
1 parent bee66d3 commit 65fb9a2

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
@@ -244,7 +244,13 @@ def winconfig_event(self, event):
244244
text.see(self.startindex)
245245
x, y, cx, cy = text.bbox(self.startindex)
246246
acw = self.autocompletewindow
247-
acw.update()
247+
if platform.system().startswith('Windows'):
248+
# On Windows an update() call is needed for the completion list
249+
# window to be created, so that we can fetch its width and
250+
# height. However, this is not needed on other platforms (tested
251+
# on Ubuntu and macOS) but at one point began causing freezes on
252+
# macOS. See issues 37849 and 41611.
253+
acw.update()
248254
acw_width, acw_height = acw.winfo_width(), acw.winfo_height()
249255
text_width, text_height = text.winfo_width(), text.winfo_height()
250256
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)