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

Michael Hudson mwh@users.sourceforge.net
Mon, 18 Mar 2002 05:31:33 -0800


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

Modified Files:
      Tag: release22-maint
	StringIO.py 
Log Message:
Make StringIO work in non-unicode builds.

Lots of tests fail in non-unicode builds, but I think most of these are 
"bugs" in the tests.  I hope so, anyway.


Index: StringIO.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/StringIO.py,v
retrieving revision 1.19.12.1
retrieving revision 1.19.12.2
diff -C2 -d -r1.19.12.1 -r1.19.12.2
*** StringIO.py	28 Jan 2002 15:00:27 -0000	1.19.12.1
--- StringIO.py	18 Mar 2002 13:31:30 -0000	1.19.12.2
***************
*** 40,44 ****
      def __init__(self, buf = ''):
          # Force self.buf to be a string or unicode
!         if type(buf) is not types.UnicodeType:
              buf = str(buf)
          self.buf = buf
--- 40,44 ----
      def __init__(self, buf = ''):
          # Force self.buf to be a string or unicode
!         if type(buf) not in types.StringTypes:
              buf = str(buf)
          self.buf = buf
***************
*** 139,143 ****
          if not s: return
          # Force s to be a string or unicode
!         if type(s) is not types.UnicodeType:
              s = str(s)
          if self.pos > self.len:
--- 139,143 ----
          if not s: return
          # Force s to be a string or unicode
!         if type(s) not in types.StringTypes:
              s = str(s)
          if self.pos > self.len: