From: Terry Jan Reedy <tjreedy@udel.edu>
Date: Mon, 9 Jul 2012 21:57:13 +0000 (-0400)
Subject: Issue 13532: Allow bytearrays to be written also.
X-Git-Tag: v2.7.4rc1~707
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f8fc674f0bc1819a85e64e1f3174b682260adab6;p=python

Issue 13532: Allow bytearrays to be written also.
---

diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
index 3e23e6c0ad..2bf97a589e 100644
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -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):
diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py
index 9389a2b0aa..67d1881060 100644
--- a/Lib/idlelib/run.py
+++ b/Lib/idlelib/run.py
@@ -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):