Message278113
> In scanning over issue 8828, I see no discussion of the consequences of not using MOVEFILE_COPY_ALLOWED in Antoine's patch, so it appears that this behavior change was unintentional.
Depending on your point of view, it *can* be seen as an enhancement.
See the documentation of MOVEFILE_COPY_ALLOWED: "If the file is
successfully copied to a different volume and the original file is
unable to be deleted, the function succeeds leaving the source file
intact." This behaviour can be seen as a source of bug. It can be
acceptable if if is expected.
Since shutil.move() already implements the copy+delete fallback, I
suggest to *not* change os.rename() but *document* the behaviour
change:
* os.rename() can fail if source and destination are on two different
file systems
* Use shutil.move() to support move to a different directory
https://docs.python.org/dev/library/shutil.html#shutil.move already
explains well the behaviour when two different filesystems are used:
"... os.rename() is used. Otherwise, src is copied to dst using
copy_function and then remove ..."
I also suggest to mention in shutil.move() doc that the source can be
left undeleted if delete fails for some reason when copy+delete is
used. |
|
Date |
User |
Action |
Args |
2016-10-05 07:34:03 | vstinner | set | recipients:
+ vstinner, paul.moore, tim.golden, zach.ware, eryksun, steve.dower, stephan |
2016-10-05 07:34:03 | vstinner | link | issue28356 messages |
2016-10-05 07:34:03 | vstinner | create | |
|