Yeah, the solution is to use io.BytesIO where bytes are read/written. On 5/9/07, Walter Dörwald <[EMAIL PROTECTED]> wrote: > guido.van.rossum wrote: > > Author: guido.van.rossum > > Date: Thu May 10 01:47:07 2007 > > New Revision: 55220 > > > > Modified: > > python/branches/py3k-struni/Lib/test/test_codecs.py > > Log: > > Don't insist on cStringIO. > > > > > > Modified: python/branches/py3k-struni/Lib/test/test_codecs.py > > ============================================================================== > > --- python/branches/py3k-struni/Lib/test/test_codecs.py (original) > > +++ python/branches/py3k-struni/Lib/test/test_codecs.py Thu May 10 > > 01:47:07 2007 > > @@ -1,7 +1,8 @@ > > from test import test_support > > import unittest > > import codecs > > -import sys, cStringIO, _testcapi > > +import sys, _testcapi > > +from StringIO import StringIO > > This breaks a bunch of tests. Failures look like this: > > Traceback (most recent call last): > File "Lib/test/test_codecs.py", line 1340, in test_streamreaderwriter > self.assertEquals(srw.read(), "\xfc") > File "/var/home/walter/checkouts/Python/py3k-struni/Lib/codecs.py", > line 662, in read > return self.reader.read(size) > File "/var/home/walter/checkouts/Python/py3k-struni/Lib/codecs.py", > line 465, in read > data = self.bytebuffer + newdata > TypeError: can't concat bytes to str > > The problem is that StringIO.StringIO does: > > if not isinstance(buf, basestring): > buf = str(buf) > > which turns bytes into unicode string. > > > [...] > > Servus, > Walter > _______________________________________________ > Python-3000-checkins mailing list > [email protected] > http://mail.python.org/mailman/listinfo/python-3000-checkins >
-- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000-checkins mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000-checkins
