[issue12213] BufferedRandom: write(); read() gives different result using io and _pyio
STINNER Victor
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:
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 <report at bugs.python.org>
<http://bugs.python.org/issue12213>
_______________________________________
More information about the Python-bugs-list
mailing list