[Python-Dev] unifying os.rename semantics across platform

skip@pobox.com (Skip Montanaro) skip@pobox.com (Skip Montanaro)
Wed, 23 May 2001 07:11:51 -0500


    Peter> I agree.  May I suggest to add an optional third boolean
    Peter> parameter to os.rename called 'replace', which defaults either to
    Peter> TRUE or FALSE, so modifying existing apps will become even less
    Peter> hassle to potential porters.

In his response to my post, Guido indicated there is a race condition.
Between the time you delete the preexisting destination file and do the
actual file rename, Windows could wink out on you, leaving you with the
original src file and no original dst file.  POSIX semantics require the
rename to be atomic.  This is just not going to be possible.

Fred, perhaps my doc mod should be enhanced to identify the race condition
for people who need to use os.rename on Windows and will be forced to first
unlink the destination file.

Skip