[issue28356] Windows: os.rename different in python 2.7.12 and python 3.5.2

2021-03-05 Thread Eryk Sun
Change by Eryk Sun : -- type: behavior -> enhancement versions: -Python 3.5, Python 3.6, Python 3.7 ___ Python tracker ___ ___ Pyth

[issue28356] Windows: os.rename different in python 2.7.12 and python 3.5.2

2021-02-25 Thread Eryk Sun
Eryk Sun added the comment: The documentation of os.rename() should mention that on Windows the "operation will fail if src and dst are on different filesystems". For POSIX, instead of "will" it says "may", but the failure is a certainty in Windows since MOVEFILE_COPY_ALLOWED isn't used. --

[issue28356] Windows: os.rename different in python 2.7.12 and python 3.5.2

2016-10-05 Thread STINNER Victor
STINNER Victor added the comment: > 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. S

[issue28356] Windows: os.rename different in python 2.7.12 and python 3.5.2

2016-10-04 Thread Eryk Sun
Eryk Sun added the comment: 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. > For now I switched to shutil.move() but I suppose its not > as performant/optimal

[issue28356] Windows: os.rename different in python 2.7.12 and python 3.5.2

2016-10-04 Thread stephan
stephan added the comment: Hi, I tryed os.replace() as replacement for os.rename() too, but as you said it does not work if the files are on different drives. For now I switched to shutil.move() but I suppose its not as performant/optimal as an "move" or "rename" directly supported by the OS.

[issue28356] Windows: os.rename different in python 2.7.12 and python 3.5.2

2016-10-04 Thread Eryk Sun
Eryk Sun added the comment: 3.3 added os.replace, which on Windows entailed a switch from calling MoveFile to MoveFileEx in order to specify the MOVEFILE_REPLACE_EXISTING flag. However, not passing the MOVEFILE_COPY_ALLOWED broke compatibility with os.rename on Windows for versions prior to 3.

[issue28356] Windows: os.rename different in python 2.7.12 and python 3.5.2

2016-10-04 Thread STINNER Victor
STINNER Victor added the comment: On Python 3 on Windows, os.rename() is implemented as MoveFileExW() with flags=0. The doc says: "When moving a file, the destination can be on a different file system or volume. If the destination is on another drive, you must set the MOVEFILE_COPY_ALLOWED fl

[issue28356] Windows: os.rename different in python 2.7.12 and python 3.5.2

2016-10-04 Thread STINNER Victor
STINNER Victor added the comment: Ah, on Linux rename() also fails if src and dst are on two different filesystems: OSError: [Errno 18] Invalid cross-device link. By the way, the Python document doesn't say anything about operation on two different filesystems :-/ https://docs.python.org/dev/l