[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:09:58 CEST 2013


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

Even more!

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)
    try:
        f.seek(-CHUNK_SIZE, os.SEEK_CUR)
    except IOError:
        pass
    else:
        raise AssertionError("Didn't raise IOError")
    print f.tell()

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


More information about the pypy-issue mailing list