[Python-Dev] Re:coping with a missing fsync (original) (raw)

Scott David Daniels Scott.Daniels at Acm.Org
Sun Sep 28 19:00:53 EDT 2003


After seeing:

backup kept screwing up until FileStorage's

if fsync is not None: fsync(file.fileno()) actually did something on Windows. I suspect making the change where you obtain fsync, rather than where you call it makes the code clearer. Just after import os, you can do the appropriate bit of the following code:

    try:
        fsync = os.fsync
    except AttributeError:
        fsync = lambda filenumber: None   # Unfortunately nothing to 

call -------- or -------- fsync = os.fsync or lambda filenumber: None # if we cannot sync, do nothing

This (at least to me) emphasizes the lack of a system facility. The existing code emphasizes local solutions on a case-by-case basis. If the solution is always to skip the call, I'd find this method clearer.

-Scott Daid Daniels Scott.Daniels at Acm.Org



More information about the Python-Dev mailing list