STINNER Victor <victor.stin...@haypocalc.com> added the comment:

> 3) Fall back to the original ".tmp" suffix (with the risk
> of stale tmp file).

I missed something, what is the "stale tmp file" issue? Python/import.c uses:

    (void) unlink(filename);
    fd = open(filename, O_EXCL|O_CREAT|O_WRONLY|O_TRUNC ...);

So Python starts by removing the .tmp file, but it fails if another process is 
already writing into the .tmp file. In this case, we do nothing, which is not a 
problem: the other process will create the file.

Attached patch implements the same algorithm than import.c in importlib.

----------
Added file: http://bugs.python.org/file23597/importlib_write_atomic.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13303>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to