• Guido van Rossum's avatar
    _portable_fseek(): · 8b4e43e7
    Guido van Rossum yazdı
    Subtlety on Windows: if we change test_largefile.py to use a file
    > 4GB, it still fails.  A debug session suggests this is because
    fseek(fp, 0, 2) refuses to seek to the end of the file when the file
    is > 4GB, because it uses the SetFilePointer() in 32-bit mode.
    
    But it only fails when we seek relative to the end of the file,
    because in the other seek modes only calls to fgetpos() and fsetpos()
    are made, which use Get/SetFilePointer() in 64-bit mode.  Solution:
    #ifdef MS_WInDOWS, replace the call to fseek(fp, ...) with a call to
    _lseeki64(fileno(fp), ...).  Make sure to call fflush(fp) first.
    
    (XXX Could also replace the entire branch with a call to _lseeki64().
    Would that be more efficient?  Certainly less generated code.)
    
    (XXX This needs more testing.  I can't actually test that it works for
    files >4GB on my Win98 machine, because the filesystem here won't let
    me create files >=4GB at all.  Tim should test this on his Win2K
    machine.)
    8b4e43e7
Adı
Son kayıt (commit)
Son güncelleme
Demo Loading commit data...
Doc Loading commit data...
Grammar Loading commit data...
Include Loading commit data...
Lib Loading commit data...
Mac Loading commit data...
Misc Loading commit data...
Modules Loading commit data...
Objects Loading commit data...
PC Loading commit data...
PCbuild Loading commit data...
Parser Loading commit data...
Python Loading commit data...
RISCOS Loading commit data...
Tools Loading commit data...
.cvsignore Loading commit data...
.hgtags Loading commit data...
LICENSE Loading commit data...
Makefile.pre.in Loading commit data...
PLAN.txt Loading commit data...
README Loading commit data...
acconfig.h Loading commit data...
configure Loading commit data...
configure.in Loading commit data...
install-sh Loading commit data...
pyconfig.h.in Loading commit data...
setup.py Loading commit data...