From e1c67d1dc028b59805d29ee7e943e342da55d270 Mon Sep 17 00:00:00 2001 From: "Michael W. Hudson" Date: Mon, 13 May 2002 09:42:16 +0000 Subject: [PATCH] Make StringIO work in --disable-unicode builds... --- Lib/StringIO.py | 4 ++-- Lib/test/test_StringIO.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Lib/StringIO.py b/Lib/StringIO.py index 9225c05286..38b3e36835 100644 --- a/Lib/StringIO.py +++ b/Lib/StringIO.py @@ -39,7 +39,7 @@ __all__ = ["StringIO"] class StringIO: def __init__(self, buf = ''): # Force self.buf to be a string or unicode - if not isinstance(buf, types.UnicodeType): + if not isinstance(buf, types.StringTypes): buf = str(buf) self.buf = buf self.len = len(buf) @@ -138,7 +138,7 @@ class StringIO: raise ValueError, "I/O operation on closed file" if not s: return # Force s to be a string or unicode - if not isinstance(s, types.UnicodeType): + if not isinstance(s, types.StringTypes): s = str(s) if self.pos > self.len: self.buflist.append('\0'*(self.pos - self.len)) diff --git a/Lib/test/test_StringIO.py b/Lib/test/test_StringIO.py index a340e3b6ae..9deba0d85a 100644 --- a/Lib/test/test_StringIO.py +++ b/Lib/test/test_StringIO.py @@ -73,6 +73,8 @@ class TestStringIO(TestGenericStringIO): def test_unicode(self): + if not test_support.have_unicode: return + # The StringIO module also supports concatenating Unicode # snippets to larger Unicode strings. This is tested by this # method. Note that cStringIO does not support this extension. -- 2.40.0