diff Lib/StringIO.py @ 22382:165e20ac0ab1 2.2

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.
author Michael W. Hudson <mwh@python.net>
date Mon, 18 Mar 2002 13:31:31 +0000
parents a4e4736799b1
children 64eb119b816d
line wrap: on
line diff
--- a/Lib/StringIO.py	Mon Mar 18 13:10:41 2002 +0000
+++ b/Lib/StringIO.py	Mon Mar 18 13:31:31 2002 +0000
@@ -39,7 +39,7 @@
 class StringIO:
     def __init__(self, buf = ''):
         # Force self.buf to be a string or unicode
-        if type(buf) is not types.UnicodeType:
+        if type(buf) not in types.StringTypes:
             buf = str(buf)
         self.buf = buf
         self.len = len(buf)
@@ -138,7 +138,7 @@
             raise ValueError, "I/O operation on closed file"
         if not s: return
         # Force s to be a string or unicode
-        if type(s) is not types.UnicodeType:
+        if type(s) not in types.StringTypes:
             s = str(s)
         if self.pos > self.len:
             self.buflist.append('\0'*(self.pos - self.len))