This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients pitrou, vstinner
Date 2011-05-30.02:52:38
SpamBayes Score 1.4194654e-07
Marked as misclassified No
Message-id <1306723959.59.0.759374279051.issue12213@psf.upfronthosting.co.za>
In-reply-to
Content
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!?
History
Date User Action Args
2011-05-30 02:52:39vstinnersetrecipients: + vstinner, pitrou
2011-05-30 02:52:39vstinnersetmessageid: <1306723959.59.0.759374279051.issue12213@psf.upfronthosting.co.za>
2011-05-30 02:52:39vstinnerlinkissue12213 messages
2011-05-30 02:52:38vstinnercreate