[Python-Dev] small PATCH to fix os.fsync on OS X

Scott Dial scott+python-dev at scottdial.com
Thu Aug 7 07:44:58 CEST 2008


Richard Boulton wrote:
> I can't think of a situation where it would be useful to do an fsync() 
> in which you don't want the data to be flushed as far as possible.  If 
> you're bothering to call fsync(), it's presumably because you need to 
> guarantee that the data will be in a consistent state in the event of a 
> failure (like a power cut).  So I think it would be helpful for an fsync 
> call in a high-level language to handle the details of this.

But the file descriptor functions provided by the posix module are *not* 
high-level calls, and in fact, that is part of the point of the module. 
There is a noticeable performance penalty for waiting on F_FULLSYNC to 
complete, and a programmer who is already going outside of the normal 
mode of python file-handling (using file objects) should have a choice 
in the matter.

-Scott

-- 
Scott Dial
scott at scottdial.com
scodial at cs.indiana.edu


More information about the Python-Dev mailing list