New submission from Pascal Chambon <chambon.pas...@gmail.com>:

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

----------
components: IO
messages: 97275
nosy: pakal
severity: normal
status: open
title: buffered io seek() buggy
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7640>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to