os.rename copies when old is in-use - is this deliberate?

Tony Meyer t-meyer at ihug.co.nz
Sat Dec 3 12:03:47 CET 2005


[Tony Meyer]
>> Is this the intended behaviour?

> [Martin v. Löwis]
> Sort-of. os.rename invokes the C library's rename, and does whatever
> this does. It is expected that most platform's C libraries do what
> the documentation says rename does, but platforms may vary in their
> implementation of the C library, and from one compiler version to
> the other.
[snip links to Microsoft documentation, which don't cover the in-use  
case]

Thanks for that.  In your opinion, would a documentation patch that  
explained that this would occur on Windows (after the existing note  
about the Windows rename not being atomic) be acceptable?

(The Windows platform C library for Python 2.4+ is in msvcrt71.dll,  
right?  Does that mean that behaviour will be consistent across  
Windows versions, or could 9x/NT/XP/etc all behave differently?)

=Tony.Meyer


More information about the Python-list mailing list