mirror of
https://github.com/python/cpython.git
synced 2025-07-31 07:04:42 +00:00
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:
parent
0805e6eed9
commit
513d9aeadb
2 changed files with 10 additions and 2 deletions
|
@ -11,6 +11,7 @@ from os.path import abspath
|
||||||
import fnmatch
|
import fnmatch
|
||||||
from warnings import warn
|
from warnings import warn
|
||||||
import collections
|
import collections
|
||||||
|
import errno
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from pwd import getpwnam
|
from pwd import getpwnam
|
||||||
|
@ -105,8 +106,11 @@ def copystat(src, dst):
|
||||||
if hasattr(os, 'chmod'):
|
if hasattr(os, 'chmod'):
|
||||||
os.chmod(dst, mode)
|
os.chmod(dst, mode)
|
||||||
if hasattr(os, 'chflags') and hasattr(st, 'st_flags'):
|
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):
|
def copy(src, dst):
|
||||||
"""Copy data and mode bits ("cp src dst").
|
"""Copy data and mode bits ("cp src dst").
|
||||||
|
|
|
@ -29,6 +29,10 @@ Core and Builtins
|
||||||
Library
|
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
|
- Issue #7703: ctypes supports both buffer() and memoryview(). The former is
|
||||||
deprecated.
|
deprecated.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue