]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-78889: Stop IDLE Shell freezes from sys.stdout.shell.xyz (GH-121876) (...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 17 Jul 2024 14:03:54 +0000 (16:03 +0200)
committerGitHub <noreply@github.com>
Wed, 17 Jul 2024 14:03:54 +0000 (14:03 +0000)
gh-78889: Stop IDLE Shell freezes from sys.stdout.shell.xyz (GH-121876)

Problem occurred when attribute xyz could not be pickled.
Since this is not trivial to selectively fix, block all
attributes (other than 'width').  IDLE does not access them
and they are private implementation details.
(cherry picked from commit 58753f33e47fe48906883dc010771f68c13b7e52)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Lib/idlelib/News3.txt
Lib/idlelib/run.py
Misc/NEWS.d/next/IDLE/2024-07-16-16-57-03.gh-issue-78889.U7ghFD.rst [new file with mode: 0644]

index c92196f1f4a642ac0fdccbd70f5e8a6663440932..39791d60c0682949265177267c46d705c0a9f86a 100644 (file)
@@ -4,6 +4,9 @@ Released after 2023-10-02
 =========================
 
 
+gh-78889: Stop Shell freezes by blocking user access to non-method
+sys.stdout.shell attributes, which are all private.
+
 gh-78955: Use user-selected color theme for Help => IDLE Doc.
 
 gh-96905: In idlelib code, stop redefining built-ins 'dict' and 'object'.
index 53e80a9b42801fb305d19b4fd4fa64dc7a6de52a..476a7b26c004b505f799a8c10162592dbad3a132 100644 (file)
@@ -436,6 +436,9 @@ class StdioFile(io.TextIOBase):
 
     def __init__(self, shell, tags, encoding='utf-8', errors='strict'):
         self.shell = shell
+        # GH-78889: accessing unpickleable attributes freezes Shell.
+        # IDLE only needs methods; allow 'width' for possible use.
+        self.shell._RPCProxy__attributes = {'width': 1}
         self.tags = tags
         self._encoding = encoding
         self._errors = errors
diff --git a/Misc/NEWS.d/next/IDLE/2024-07-16-16-57-03.gh-issue-78889.U7ghFD.rst b/Misc/NEWS.d/next/IDLE/2024-07-16-16-57-03.gh-issue-78889.U7ghFD.rst
new file mode 100644 (file)
index 0000000..604194e
--- /dev/null
@@ -0,0 +1,2 @@
+Stop Shell freezes by blocking user access to non-method sys.stdout.shell attributes,
+which are all private.