summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 2ddeb2a..98b7ea0 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 as 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 8d4706d..86eda39 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -287,6 +287,10 @@ C-API
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 #7860: platform.uname now reports the correct 'machine' type
when Python is running in WOW64 mode on 64 bit Windows.