]> granicus.if.org Git - python/commitdiff
Issue #19481: print() of string subclass instance in IDLE no more hangs.
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 10 Dec 2013 08:05:19 +0000 (10:05 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 10 Dec 2013 08:05:19 +0000 (10:05 +0200)
Lib/idlelib/PyShell.py
Misc/NEWS

index b2a1f58c1372a1cf06cd714f2d0fdc4405f21a65..f50ca284e0f7af6a41b0d9dfa2292812ee723e49 100644 (file)
@@ -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)
 
 
index c0c543a73ab98ff603155a62eaa9f700cc050ac2..535c3af0be44e50698768b29f9b534efb1a9af09 100644 (file)
--- 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
 -----