Todd Rovito added the comment:

David,
   Thanks for your bug report. Indeed os.rename does not exhibit the same 
behavior as the documentation describes. 

For Python 3.4 here is the fix I came up with:
"Rename the file or directory src to dst. If dst is a directory that is not 
empty, OSError will be raised. On Unix, if dst exists and is a file, it will be 
replaced silently if the user has permission and src is a file. On Unix, if src 
is a directory and dst is a file NotADirectoryError will be raised. The 
operation may fail on some Unix flavors if src and dst are on different 
filesystems. If successful, the renaming will be an atomic operation (this is a 
POSIX requirement). On Windows, if dst already exists, OSError will be raised 
even if it is a file."

I have attached a Python 3.4 patch for consideration.  This might not be the 
best phrasing so please feel free to offer alternatives.

----------
keywords: +patch
Added file: http://bugs.python.org/file27640/OSRenameTest3point4.patch

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

Reply via email to