From: Serhiy Storchaka Date: Tue, 10 Dec 2013 08:05:19 +0000 (+0200) Subject: Issue #19481: print() of string subclass instance in IDLE no more hangs. X-Git-Tag: v3.4.0b2~269^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9df8a1c1126e5db933300495974c06dcb592528e;p=python Issue #19481: print() of string subclass instance in IDLE no more hangs. --- diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index b2a1f58c13..f50ca284e0 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) diff --git a/Misc/NEWS b/Misc/NEWS index c0c543a73a..535c3af0be 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -106,6 +106,11 @@ Library - Issue #19286: Directories in ``package_data`` are no longer added to the filelist, preventing failure outlined in the ticket. +IDLE +---- + +- Issue #19481: print() of string subclass instance in IDLE no more hangs. + Tests -----