New submission from fireattack <human.p...@gmail.com>:

According to https://docs.python.org/3.8/library/shutil.html#shutil.move

"If the destination already exists but is not a directory, it may be 
overwritten depending on os.rename() semantics."

I interpret "depending on os.rename() semantics" to mean it will follow 
os.rename()'s behavior.

According to https://docs.python.org/3/library/os.html#os.rename

"On Windows, if dst exists a FileExistsError is always raised."

However, their behaviors are not the same.

For os.rename, it does raise FileExistsError if dst exists.
For shutil.move, it silently overwrites dst.

It's either a bug in behavior of shutil.move, or the documentation need to be 
updated.

----------
components: Library (Lib)
messages: 385083
nosy: fireattack
priority: normal
severity: normal
status: open
title: On Windows, shutil.move doesn't raise FileExistsError if dst exists like 
os.rename
type: behavior
versions: Python 3.9

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

Reply via email to