[New-bugs-announce] [issue12213] BufferedRandom: write(); read() gives different result using io and _pyio
report at bugs.python.org
Mon May 30 04:52:39 CEST 2011
New submission from STINNER Victor <victor.stinner at 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:
print("pos?", f.tell(), raw.tell())
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!?
nosy: haypo, pitrou
title: BufferedRandom: write(); read() gives different result using io and _pyio
versions: Python 3.3
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce