summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-03-22 19:59:46 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-03-22 19:59:46 (GMT)
commit513d9aeadb09b460e968054c7ed78c385835dcd4 (patch)
tree2ae3b8b7bbee4f66bbe90bef91e9909e6716c580
parent0805e6eed94015cee09ba052deda2e1c94c182b3 (diff)
downloadcpython-513d9aeadb09b460e968054c7ed78c385835dcd4.zip
cpython-513d9aeadb09b460e968054c7ed78c385835dcd4.tar.gz
cpython-513d9aeadb09b460e968054c7ed78c385835dcd4.tar.bz2
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.
-rw-r--r--Lib/shutil.py8
-rw-r--r--Misc/NEWS4
2 files changed, 10 insertions, 2 deletions
diff --git a/Lib/shutil.py b/Lib/shutil.py
index df571e7..0dfc7c7 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -11,6 +11,7 @@ from os.path import abspath
import fnmatch
from warnings import warn
import collections
+import errno
try:
from pwd import getpwnam
@@ -105,8 +106,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").
diff --git a/Misc/NEWS b/Misc/NEWS
index 1824f5f..f207082 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -29,6 +29,10 @@ Core and Builtins
Library
-------
+- 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.
+
- Issue #7703: ctypes supports both buffer() and memoryview(). The former is
deprecated.