From 747947f9ff300f2fee12bd5c58ac55eb9027680f Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 21 Sep 2024 22:13:59 -0400 Subject: [PATCH 1/3] gh-112938: IDLE - revert '_idletasks' addition in outwin gh-88496 replaced text.update with text.update_idletasks in two files to fix test failures on macOS. While theoretically correct, the result was Shell freezing when receiving continuous short strings to print. The guess is that there was no idle time in which to do the screen update. Reverting the change in one of the files, outwin, fixes the issue. The test will be patched as needed on macOS. --- Lib/idlelib/outwin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/idlelib/outwin.py b/Lib/idlelib/outwin.py index 5ed3f35a7af655..8baa657550de94 100644 --- a/Lib/idlelib/outwin.py +++ b/Lib/idlelib/outwin.py @@ -112,7 +112,7 @@ def write(self, s, tags=(), mark="insert"): assert isinstance(s, str) self.text.insert(mark, s, tags) self.text.see(mark) - self.text.update_idletasks() + self.text.update() return len(s) def writelines(self, lines): From 150bf2e74d0354d409eb6e750b02bb712c68cede Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 21 Sep 2024 23:04:18 -0400 Subject: [PATCH 2/3] Fix tests on mac for idletasks reversion --- Lib/idlelib/idle_test/test_outwin.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Lib/idlelib/idle_test/test_outwin.py b/Lib/idlelib/idle_test/test_outwin.py index d6e85ad674417c..81f4aad7e95e95 100644 --- a/Lib/idlelib/idle_test/test_outwin.py +++ b/Lib/idlelib/idle_test/test_outwin.py @@ -1,6 +1,7 @@ "Test outwin, coverage 76%." from idlelib import outwin +import sys import unittest from test.support import requires from tkinter import Tk, Text @@ -18,6 +19,10 @@ def setUpClass(cls): root.withdraw() w = cls.window = outwin.OutputWindow(None, None, None, root) cls.text = w.text = Text(root) + if sys.platform == 'darwin': # Issue 112938 + cls.text.update = cls.text.update_idletasks + # Without this, test write, writelines, and goto... fail. + # The reasons and why macOS-specific are unclear. @classmethod def tearDownClass(cls): From 13e5902149e9942bb4d581f9b41406c35bd034d7 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 21 Sep 2024 23:12:33 -0400 Subject: [PATCH 3/3] blurb --- .../next/IDLE/2024-09-21-23-12-18.gh-issue-112938.OeiDru.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/IDLE/2024-09-21-23-12-18.gh-issue-112938.OeiDru.rst diff --git a/Misc/NEWS.d/next/IDLE/2024-09-21-23-12-18.gh-issue-112938.OeiDru.rst b/Misc/NEWS.d/next/IDLE/2024-09-21-23-12-18.gh-issue-112938.OeiDru.rst new file mode 100644 index 00000000000000..0cd058eeffb1d5 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2024-09-21-23-12-18.gh-issue-112938.OeiDru.rst @@ -0,0 +1 @@ +Fix uninteruptable hang when Shell gets rapid continuous output.