Patches item #1704547, was opened at 2007-04-20 20:48
Message generated for change (Settings changed) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1704547&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: Python 2.6
Status: Open
Resolution: None
>Priority: 6
Private: No
Submitted By: Raghuram Devarakonda (draghuram)
>Assigned to: Martin v. Löwis (loewis)
Summary: Use MoveFileEx() to implement os.rename() on windows

Initial Comment:

This patch is to fix bug 1693753. Basically, os.rename(src, dst) fails on 
windows if dst already exists. This is because MoveFile() is used to implement 
rename. This patch replaces this API with MoveFileEx() and uses the flag 
MOVEFILE_REPLACE_EXISTING causing the API to replace the dst if it already 
exists. This brings the behaviour in line with unix. Note that, I also use the 
flag MOVEFILE_COPY_ALLOWED which is required if dst is on a different volume. 
However, moving to a different volume may not be atomic operation (I am not 
sure about this) as the msdn doc says that move in this case is simulated with 
CopyFile() and DeleteFile(). 

The patch also includes a test case and doc update. Please let me know if the 
location of test case and name of test function are ok. Also, MoveFileEx() is 
only available on NT+ windows but it should be ok as support for Win9x, WinME 
is removed in 2.6.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1704547&group_id=5470
_______________________________________________
Patches mailing list
Patches@python.org
http://mail.python.org/mailman/listinfo/patches

Reply via email to