New submission from STINNER Victor <victor.stin...@haypocalc.com>:

The following code displays "Xbc" using io, and "bc" using _pyio (or an 
unbuffered file, e.g. io.FileIO):
-------------
import _pyio, io

with io.BytesIO(b'abc') as raw:
    #with _pyio.BufferedRandom(raw) as f:
    with io.BufferedRandom(raw) as f:
        f.write(b"X")
        print("pos?", f.tell(), raw.tell())
        print(f.read())
-------------

I expect .write() to change the file position, and so "bc" must be the correct 
result, not "Wbc".

_pyio.BufferedRandom overrides its write method, whereas io.BufferedRandom 
doesn't.

I already noticed the implement difference of BufferedRandom.write(), but I 
don't remember if I reported it or not!?

----------
messages: 137238
nosy: haypo, pitrou
priority: normal
severity: normal
status: open
title: BufferedRandom: write(); read() gives different result using io and _pyio
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12213>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to