Commit f8fc674f authored by Terry Jan Reedy's avatar Terry Jan Reedy

Issue 13532: Allow bytearrays to be written also.

parent 9e6bf1a8
......@@ -1265,8 +1265,8 @@ class PseudoFile(object):
self.encoding = encoding
def write(self, s):
if not isinstance(s, basestring):
raise TypeError('must be str, not ' + type(s).__name__)
if not isinstance(s, (basestring, bytearray)):
raise TypeError('must be string, not ' + type(s).__name__)
self.shell.write(s, self.tags)
def writelines(self, lines):
......
......@@ -263,8 +263,8 @@ class _RPCFile(io.TextIOBase):
return setattr(self.rpc, name, value)
def write(self, s):
if not isinstance(s, basestring):
raise TypeError('must be str, not ' + type(s).__name__)
if not isinstance(s, (basestring, bytearray)):
raise TypeError('must be string, not ' + type(s).__name__)
return self.rpc.write(s)
class MyHandler(rpc.RPCHandler):
......
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