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

This commit is contained in:
Martin v. Löwis 2012-07-09 21:01:49 +02:00
parent 45ed012433
commit e8e4e1456c
3 changed files with 25 additions and 3 deletions

View file

@ -1265,6 +1265,8 @@ class PseudoFile(object):
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):