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 pakal
Recipients pakal
Date 2010-01-05.19:38:08
SpamBayes Score 7.078533e-07
Marked as misclassified No
Message-id <1262720290.8.0.413817675363.issue7640@psf.upfronthosting.co.za>
In-reply-to
Content
I've noticed a severe bug in my python 2.6.2 io module, and looking at _buffered_raw_seek in http://svn.python.org/view/python/trunk/Modules/_io/bufferedio.c?view=markup, it seems the bug is still there in the C reimplementation of buffered io classes.

The problem is, if we seek a buffered stream with whence=os.SEEK_CUR, that call is directly transmitted to the underlying raw stream, which has not the same file pointer position as the buffered stream. So in the end, the file pointer doesn't get moved at the right absolute offset, but at an offset which depends of the state of the read head buffer or the write buffer.
When using os.SEEK_CUR, it would be necessary to call tell() or to manually compute offsets, so that the seek() works as expected.

Regards, 
Pascal
History
Date User Action Args
2010-01-05 19:38:10pakalsetrecipients: + pakal
2010-01-05 19:38:10pakalsetmessageid: <1262720290.8.0.413817675363.issue7640@psf.upfronthosting.co.za>
2010-01-05 19:38:09pakallinkissue7640 messages
2010-01-05 19:38:08pakalcreate