[issue8604] Adding an atomic FS write API

STINNER Victor report at bugs.python.org
Thu May 16 02:12:13 CEST 2013


STINNER Victor added the comment:

> Here's the part of the code that does the open/close part:
> http://bazaar.launchpad.net/~exabyte/blackherd/async-refactor/view/61/blackherd/misc.py#L498

This code contains a bug: hasattr('os', 'fsync') is never True :-)

This part is interesting:

        # fsync on Mac OS X doesn't work, it requires using the
        # F_FULLSYNC fcntl
        if hasattr(fcntl, 'F_FULLFSYNC'):
            fcntl.fcntl(self._fd, fcntl.F_FULLFSYNC)

=> see also #11877

> http://trac.edgewall.org/browser/trunk/trac/util/__init__.py?#L145

This class copies file owner, permissions, flags, etc. atomic_write() should probably also call copystat() on the temporary file.

----------

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


More information about the Python-bugs-list mailing list