[Python-checkins] cpython (merge 3.3 -> default): Issue #19481: print() of string subclass instance in IDLE no more hangs.

serhiy.storchaka python-checkins at python.org
Tue Dec 10 09:07:31 CET 2013


http://hg.python.org/cpython/rev/1d68ea8148ce
changeset: 87872:1d68ea8148ce
parent: 87869:96a68e369d13
parent: 87871:d462b2bf875b
user: Serhiy Storchaka <storchaka at gmail.com>
date: Tue Dec 10 10:06:35 2013 +0200
summary:
 Issue #19481: print() of string subclass instance in IDLE no more hangs.
files:
 Lib/idlelib/PyShell.py | 7 +++++--
 Misc/NEWS | 5 +++++
 2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -1334,8 +1334,11 @@
 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
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -128,6 +128,11 @@
 - Issue #19545: Avoid chained exceptions while passing stray % to
 time.strptime(). Initial patch by Claudiu Popa.
 
+IDLE
+----
+
+- Issue #19481: print() of string subclass instance in IDLE no more hangs.
+
 Tests
 -----
 
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /