From 9df8a1c1126e5db933300495974c06dcb592528e Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Tue, 10 Dec 2013 10:05:19 +0200 Subject: Issue #19481: print() of string subclass instance in IDLE no more hangs. --- Lib/idlelib/PyShell.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Lib/idlelib/PyShell.py') diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index b2a1f58c137..f50ca284e0f 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) -- cgit v1.2.3