[Python-checkins] CVS: python/dist/src/Lib StringIO.py,1.18,1.19

M.-A. Lemburg lemburg@users.sourceforge.net
Mon, 24 Sep 2001 10:34:54 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv20159/Lib

Modified Files:
	StringIO.py 
Log Message:
StringIO patch #462596: let's [c]StringIO accept read buffers on
input to .write() too.



Index: StringIO.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/StringIO.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** StringIO.py	2001/09/22 04:34:54	1.18
--- StringIO.py	2001/09/24 17:34:52	1.19
***************
*** 39,43 ****
  class StringIO:
      def __init__(self, buf = ''):
!         self.buf = buf
          self.len = len(buf)
          self.buflist = []
--- 39,44 ----
  class StringIO:
      def __init__(self, buf = ''):
!         # Force self.buf to be a string
!         self.buf = str(buf)
          self.len = len(buf)
          self.buflist = []
***************
*** 135,138 ****
--- 136,141 ----
              raise ValueError, "I/O operation on closed file"
          if not s: return
+         # Force s to be a string
+         s = str(s)
          if self.pos > self.len:
              self.buflist.append('\0'*(self.pos - self.len))