summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/run.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2024-07-17 13:33:33 (GMT)
committerGitHub <noreply@github.com>2024-07-17 13:33:33 (GMT)
commit58753f33e47fe48906883dc010771f68c13b7e52 (patch)
tree469f9bde20da726fb5b290579480e99746c68279 /Lib/idlelib/run.py
parent6682d916780c1cb305e679a057ee6992b114118e (diff)
downloadcpython-58753f33e47fe48906883dc010771f68c13b7e52.zip
cpython-58753f33e47fe48906883dc010771f68c13b7e52.tar.gz
cpython-58753f33e47fe48906883dc010771f68c13b7e52.tar.bz2
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.
Diffstat (limited to 'Lib/idlelib/run.py')
-rw-r--r--Lib/idlelib/run.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py
index 8974b52..8f98e73 100644
--- a/Lib/idlelib/run.py
+++ b/Lib/idlelib/run.py
@@ -443,6 +443,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