]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41611: IDLE: fix freezing on completion on macOS (GH-26400)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 27 May 2021 15:08:00 +0000 (08:08 -0700)
committerGitHub <noreply@github.com>
Thu, 27 May 2021 15:08:00 +0000 (08:08 -0700)
(cherry picked from commit abc4bd5db91c86b6b74289241378a13bd3a0a5e2)

Co-authored-by: Tal Einat <532281+taleinat@users.noreply.github.com>
Lib/idlelib/autocomplete_w.py
Misc/NEWS.d/next/IDLE/2021-05-27-13-39-43.bpo-41611.liNQqj.rst [new file with mode: 0644]

index fe7a6be83d586b2bb5dfe50cd9110efa46602579..43c0365db0c55440dc9d49b09b498ce263c2e901 100644 (file)
@@ -244,7 +244,13 @@ class AutoCompleteWindow:
         text.see(self.startindex)
         x, y, cx, cy = text.bbox(self.startindex)
         acw = self.autocompletewindow
-        acw.update()
+        if platform.system().startswith('Windows'):
+            # On Windows an update() call is needed for the completion list
+            # window to be created, so that we can fetch its width and
+            # height. However, this is not needed on other platforms (tested
+            # on Ubuntu and macOS) but at one point began causing freezes on
+            # macOS.  See issues 37849 and 41611.
+            acw.update()
         acw_width, acw_height = acw.winfo_width(), acw.winfo_height()
         text_width, text_height = text.winfo_width(), text.winfo_height()
         new_x = text.winfo_rootx() + min(x, max(0, text_width - acw_width))
diff --git a/Misc/NEWS.d/next/IDLE/2021-05-27-13-39-43.bpo-41611.liNQqj.rst b/Misc/NEWS.d/next/IDLE/2021-05-27-13-39-43.bpo-41611.liNQqj.rst
new file mode 100644 (file)
index 0000000..27d778b
--- /dev/null
@@ -0,0 +1 @@
+Fix IDLE sometimes freezing upon tab-completion on macOS.