Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a6516de

Browse files
[3.12] gh-78889: Stop IDLE Shell freezes from sys.stdout.shell.xyz (GH-121876) (#121912)
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 58753f3) Co-authored-by: Terry Jan Reedy <[email protected]>
1 parent 874eed6 commit a6516de

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

Lib/idlelib/News3.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Released after 2023-10-02
44
=========================
55

66

7+
gh-78889: Stop Shell freezes by blocking user access to non-method
8+
sys.stdout.shell attributes, which are all private.
9+
710
gh-78955: Use user-selected color theme for Help => IDLE Doc.
811

912
gh-96905: In idlelib code, stop redefining built-ins 'dict' and 'object'.

Lib/idlelib/run.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,9 @@ class StdioFile(io.TextIOBase):
436436

437437
def __init__(self, shell, tags, encoding='utf-8', errors='strict'):
438438
self.shell = shell
439+
# GH-78889: accessing unpickleable attributes freezes Shell.
440+
# IDLE only needs methods; allow 'width' for possible use.
441+
self.shell._RPCProxy__attributes = {'width': 1}
439442
self.tags = tags
440443
self._encoding = encoding
441444
self._errors = errors
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Stop Shell freezes by blocking user access to non-method sys.stdout.shell attributes,
2+
which are all private.

0 commit comments

Comments
 (0)