Merged revisions 79299 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79299 | antoine.pitrou | 2010-03-22 20:59:46 +0100 (lun., 22 mars 2010) | 5 lines

  Issue #7512: shutil.copystat() could raise an OSError when the filesystem
  didn't support chflags() (for example ZFS under FreeBSD).  The error is
  now silenced.
........
This commit is contained in:
Antoine Pitrou 2010-03-22 20:03:59 +00:00
parent 498c43866a
commit ab5a9997e0
2 changed files with 10 additions and 2 deletions

View file

@ -9,6 +9,7 @@ import sys
import stat
from os.path import abspath
import fnmatch
import errno
__all__ = ["copyfileobj","copyfile","copymode","copystat","copy","copy2",
"copytree","move","rmtree","Error"]
@ -74,8 +75,11 @@ def copystat(src, dst):
if hasattr(os, 'chmod'):
os.chmod(dst, mode)
if hasattr(os, 'chflags') and hasattr(st, 'st_flags'):
os.chflags(dst, st.st_flags)
try:
os.chflags(dst, st.st_flags)
except OSError, why:
if not hasattr(errno, 'EOPNOTSUPP') or why.errno != errno.EOPNOTSUPP:
raise
def copy(src, dst):
"""Copy data and mode bits ("cp src dst").