[Python-Dev] Re: RELEASED Python 2.3.1

Tim Peters tim.one at comcast.net
Mon Sep 29 11:58:43 EDT 2003


[Skip Montanaro]
> Then shouldn't a file.flush() call be sufficient to force a call to
> write(2) on POSIX systems?

The POSIX spec doesn't say that, but it does say enough that it shouldn't
matter whether or not an fflush implementation happens to call write under
the covers -- POSIX fflush is required to write data "to the file"
regardless of how it's implemented.

A difficulty with Windows is that a file ain't an inode -- a file doesn't
exist except in a directory, and the directory structure records the current
length of the files in the directory.  Writing data to a file doesn't
necessarily update the file length stored in the file's directory entry, and
flushing doesn't necessary update it either; _commit() does.  Native Windows
utilities get their idea of a file's length from reading the file's
directory entry.

> ...
> It's been established that os.fsync() is required for Windows in at
> least some circumstances, so you have to assume it's required under
> all circumstances, correct?

Sorry, I didn't follow the question.




More information about the Python-Dev mailing list