[pypy-issue] [issue1582] file.tell() has wrong position after failed seek with SEEK_CUR

Alex Gaynor tracker at bugs.pypy.org
Tue Aug 13 00:08:42 CEST 2013


Alex Gaynor <alex.gaynor at gmail.com> added the comment:

Very slightly more reduced:


import os
from tempfile import TemporaryFile


CHUNK_SIZE = 25

with TemporaryFile('r+w') as f:
    f.write('123456789x12345678><123456789\n')

    f.seek(0, os.SEEK_END)
    f.seek(-CHUNK_SIZE, os.SEEK_CUR)
    f.read(CHUNK_SIZE)
    f.seek(-CHUNK_SIZE, os.SEEK_CUR)
    f.tell()
    try:
        f.seek(-CHUNK_SIZE, os.SEEK_CUR)
    except IOError:
        pass
    else:
        raise AssertionError("Didn't raise IOError")
    print f.tell()

----------
status: unread -> chatting

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1582>
________________________________________


More information about the pypy-issue mailing list