Message137238
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!? |
|
Date |
User |
Action |
Args |
2011-05-30 02:52:39 | vstinner | set | recipients:
+ vstinner, pitrou |
2011-05-30 02:52:39 | vstinner | set | messageid: <1306723959.59.0.759374279051.issue12213@psf.upfronthosting.co.za> |
2011-05-30 02:52:39 | vstinner | link | issue12213 messages |
2011-05-30 02:52:38 | vstinner | create | |
|