Kaydet (Commit) 0ed6c4ae authored tarafından Serhiy Storchaka's avatar Serhiy Storchaka

Issue #19481: print() of string subclass instance in IDLE no more hangs.

...@@ -1334,8 +1334,11 @@ class PseudoOutputFile(PseudoFile): ...@@ -1334,8 +1334,11 @@ class PseudoOutputFile(PseudoFile):
def write(self, s): def write(self, s):
if self.closed: if self.closed:
raise ValueError("write to closed file") raise ValueError("write to closed file")
if not isinstance(s, str): if type(s) is not str:
raise TypeError('must be str, not ' + type(s).__name__) 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) return self.shell.write(s, self.tags)
......
...@@ -128,6 +128,11 @@ Library ...@@ -128,6 +128,11 @@ Library
- Issue #19545: Avoid chained exceptions while passing stray % to - Issue #19545: Avoid chained exceptions while passing stray % to
time.strptime(). Initial patch by Claudiu Popa. time.strptime(). Initial patch by Claudiu Popa.
IDLE
----
- Issue #19481: print() of string subclass instance in IDLE no more hangs.
Tests Tests
----- -----
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment