Author vstinner
Recipients tarek, vstinner
Date 2010-05-27.09:45:56
SpamBayes Score 0.450337
Marked as misclassified No
Message-id <1274953559.42.0.416381234076.issue8828@psf.upfronthosting.co.za>
In-reply-to
Content
A first implementation can be:

if os.name in ('nt', 'ce'):
   def atomic_rename(a, b):
      if os.path.exists(b):
         unlink(b)
      rename(a, b)
else:
   atomic_rename = os.rename

This implementation is atomic on POSIX, and not atomic on Windows. Tell me if I am wrong.

It can be improved later by adding the support of better Windows functions.
History
Date User Action Args
2010-05-27 09:45:59vstinnersetrecipients: + vstinner, tarek
2010-05-27 09:45:59vstinnersetmessageid: <1274953559.42.0.416381234076.issue8828@psf.upfronthosting.co.za>
2010-05-27 09:45:57vstinnerlinkissue8828 messages
2010-05-27 09:45:56vstinnercreate