mirror of
https://github.com/python/cpython.git
synced 2025-11-09 01:51:26 +00:00
Issue #13532: Check that arguments to sys.stdout.write are strings.
This commit is contained in:
parent
44dea9d03f
commit
9ae3f7a189
3 changed files with 25 additions and 3 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue