[Python-checkins] cpython (2.7): Issue 13532: Allow bytearrays to be written also.
terry.reedy
python-checkins at python.org
Mon Jul 9 23:58:17 CEST 2012
http://hg.python.org/cpython/rev/4f891f44ec15
changeset: 78045:4f891f44ec15
branch: 2.7
parent: 78037:2993f566c82e
user: Terry Jan Reedy <tjreedy at udel.edu>
date: Mon Jul 09 17:57:13 2012 -0400
summary:
Issue 13532: Allow bytearrays to be written also.
files:
Lib/idlelib/PyShell.py | 4 ++--
Lib/idlelib/run.py | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -1265,8 +1265,8 @@
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
--- a/Lib/idlelib/run.py
+++ b/Lib/idlelib/run.py
@@ -263,8 +263,8 @@
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):
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list