mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
On David Ascher's recommendation: reversed order of 'utime()' and
'chmod()' in 'copy_file()'.
This commit is contained in:
parent
a8d0f4fd2d
commit
5116f90ece
1 changed files with 5 additions and 2 deletions
|
@ -198,10 +198,13 @@ def copy_file (src, dst,
|
|||
_copy_file_contents (src, dst)
|
||||
if preserve_mode or preserve_times:
|
||||
st = os.stat (src)
|
||||
if preserve_mode:
|
||||
os.chmod (dst, S_IMODE (st[ST_MODE]))
|
||||
|
||||
# According to David Ascher <da@ski.org>, utime() should be done
|
||||
# before chmod() (at least under NT).
|
||||
if preserve_times:
|
||||
os.utime (dst, (st[ST_ATIME], st[ST_MTIME]))
|
||||
if preserve_mode:
|
||||
os.chmod (dst, S_IMODE (st[ST_MODE]))
|
||||
|
||||
return 1
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue