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

Skip to content

Commit 58753f3

Browse files
authored
gh-78889: Stop IDLE Shell freezes from sys.stdout.shell.xyz (#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.
1 parent 6682d91 commit 58753f3

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 on 2024-10-xx
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
@@ -443,6 +443,9 @@ class StdioFile(io.TextIOBase):
443443

444444
def __init__(self, shell, tags, encoding='utf-8', errors='strict'):
445445
self.shell = shell
446+
# GH-78889: accessing unpickleable attributes freezes Shell.
447+
# IDLE only needs methods; allow 'width' for possible use.
448+
self.shell._RPCProxy__attributes = {'width': 1}
446449
self.tags = tags
447450
self._encoding = encoding
448451
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)