[Python-3000] StringIO/BytesIO in io.py doesn't over-seek properly
Alexandre Vassalotti
alexandre at peadrop.com
Mon Jun 25 20:14:16 CEST 2007
On 6/23/07, Guido van Rossum <guido at python.org> wrote:
> On 6/23/07, Alexandre Vassalotti <alexandre at peadrop.com> wrote:
> > I agree with this. I will try to write a patch to fix io.BytesIO.
>
> Great!
I got the patch (it's attached to this email). The fix was simpler
than I thought.
I would like to write a unittest for it, but I am not sure where it
should go in test_io.py. From what I see, MemorySeekTestMixin is for
testing read/seek operation common to BytesIO and StringIO, so I can't
put it there. And I don't really like the idea of adding another test
in IOTest.test_raw_bytes_io.
By the way, I am having the same problem for the tests of _string_io
and _bytes_io -- i.e., I don't know exactly how to organize them with
the rest of the tests in test_io.py.
> > Free the resources held by the object, and make all methods of the
> > object raise a ValueError if they are used.
>
> I'm not sure what the use case for that is (even though the 2.x
> StringIO does this).
>
It seem the close method on TextIOWrapper objects is broken too (or at
least, bizarre):
>>> f = open('test', 'w')
>>> f.write('hello')
5
>>> f.close()
>>> f.write('hello')
5
>>> ^D
$ hd test
00000000 68 65 6c 6c 6f |hello|
00000005
-- Alexandre
-------------- next part --------------
A non-text attachment was scrubbed...
Name: overseek-bytesio.patch
Type: text/x-patch
Size: 608 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-3000/attachments/20070625/25c904d4/attachment.bin
More information about the Python-3000
mailing list