Charles-François Natali <neolo...@free.fr> added the comment: The recent issue #13146 renewed my interest, so I'd like to make this move forward, since I think an atomic rename/write API could be quite useful. Issue #8604 (Adding an atomic FS write API) can be achieved relatively easily with the typical (fsync() left aside) - create temporary file - write to the temp file - atomically rename the temp file to the target path
But the problem is that rename is only atomic on POSIX, and not on Windows. So I'd suggest to: - rename this issue to target specifically Windows ;-) - add MoveFileTransacted to the standard library (PC/msvcrtmodule.c, posixmodule?) I'm -1 on exposing a "best effort" atomic rename/file API: either the OS offers the primitives necessary to achieve atomicity, or it doesn't. It's better to have a working implementation on some OSes than a flaky implementation on every OS. Note that I'll happily take over the atomic file API part (issue #8604), but since my Windows kung-fu is so poor, it'd be nice if someone with some Windows experience could tackle this MoveFileTransacted ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8828> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com