diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-12-10 08:05:19 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-12-10 08:05:19 (GMT) |
commit | 9df8a1c1126e5db933300495974c06dcb592528e (patch) | |
tree | f392c34bd7d5f8bb8bc8b4910837344923326daa /Lib | |
parent | d860d5cf6da3feec422e2665a8e2acbbd35e75ab (diff) | |
download | cpython-9df8a1c1126e5db933300495974c06dcb592528e.zip cpython-9df8a1c1126e5db933300495974c06dcb592528e.tar.gz cpython-9df8a1c1126e5db933300495974c06dcb592528e.tar.bz2 |
Issue #19481: print() of string subclass instance in IDLE no more hangs.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/idlelib/PyShell.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index b2a1f58..f50ca28 100644 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -1331,8 +1331,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) |