Issue #13532: Check that arguments to sys.stdout.write are strings.

This commit is contained in:
Martin v. Löwis 2012-07-09 20:46:11 +02:00
parent 44dea9d03f
commit 9ae3f7a189
3 changed files with 25 additions and 3 deletions

View file

@ -1242,6 +1242,8 @@ def __init__(self, shell, tags, encoding=None):
self.encoding = encoding
def write(self, s):
if not isinstance(s, str):
raise TypeError('must be str, not ' + type(s).__name__)
self.shell.write(s, self.tags)
def writelines(self, lines):