summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/PyShell.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-12-10 08:06:35 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-12-10 08:06:35 (GMT)
commit0ed6c4ae623323a3c491bd2eaaa8956ba2c6b6fa (patch)
treec563d5214b7050815f01e7de03ec4d2a52f77db8 /Lib/idlelib/PyShell.py
parente3c39ddd97a0582c6594207cc367ad8ae01ffe01 (diff)
parent9df8a1c1126e5db933300495974c06dcb592528e (diff)
downloadcpython-0ed6c4ae623323a3c491bd2eaaa8956ba2c6b6fa.zip
cpython-0ed6c4ae623323a3c491bd2eaaa8956ba2c6b6fa.tar.gz
cpython-0ed6c4ae623323a3c491bd2eaaa8956ba2c6b6fa.tar.bz2
Issue #19481: print() of string subclass instance in IDLE no more hangs.
Diffstat (limited to 'Lib/idlelib/PyShell.py')
-rw-r--r--Lib/idlelib/PyShell.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
index 36aff92..176170f 100644
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -1334,8 +1334,11 @@ class PseudoOutputFile(PseudoFile):
def write(self, s):
if self.closed:
raise ValueError("write to closed file")
- if not isinstance(s, str):
- raise TypeError('must be str, not ' + type(s).__name__)
+ if type(s) is not str:
+ if not isinstance(s, str):
+ raise TypeError('must be str, not ' + type(s).__name__)
+ # See issue #19481
+ s = str.__str__(s)
return self.shell.write(s, self.tags)