[issue23414] seek(count, whence) accepts bogus whence on windows, python2.7

eryksun report at bugs.python.org
Sun Feb 8 23:38:09 CET 2015


eryksun added the comment:

The whence argument is used in a switch statement that handles SEEK_END and SEEK_CUR. It doesn't raise an error for an invalid whence value. It just falls through to the fsetpos call.

_portable_fseek
https://hg.python.org/cpython/file/648dcafa7e5f/Objects/fileobject.c#l692

    0:000> k 3
    Child-SP          RetAddr           Call Site
    00000000`0021fa68 00000000`1e0ac84f MSVCR90!fsetpos
    00000000`0021fa70 00000000`1e0aeea3 python27!_portable_fseek+0x6f
    00000000`0021faa0 00000000`1e0c3d09 python27!file_seek+0x123

Why does it manually handle whence and call fgetpos/fsetpos instead of calling _fseeki64?

fseek, _fseeki64
https://msdn.microsoft.com/en-us/library/75yw9bf3%28v=vs.90%29.aspx

----------
nosy: +eryksun

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23414>
_______________________________________


More information about the Python-bugs-list mailing list