[Python-checkins] r79302 - in python/branches/release31-maint: Lib/shutil.py Misc/NEWS

antoine.pitrou python-checkins at python.org
Mon Mar 22 21:12:40 CET 2010


Author: antoine.pitrou
Date: Mon Mar 22 21:12:40 2010
New Revision: 79302

Log:
Merged revisions 79301 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r79301 | antoine.pitrou | 2010-03-22 21:11:09 +0100 (lun., 22 mars 2010) | 11 lines
  
  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.
  ........
................


Modified:
   python/branches/release31-maint/   (props changed)
   python/branches/release31-maint/Lib/shutil.py
   python/branches/release31-maint/Misc/NEWS

Modified: python/branches/release31-maint/Lib/shutil.py
==============================================================================
--- python/branches/release31-maint/Lib/shutil.py	(original)
+++ python/branches/release31-maint/Lib/shutil.py	Mon Mar 22 21:12:40 2010
@@ -9,6 +9,7 @@
 import stat
 from os.path import abspath
 import fnmatch
+import errno
 
 __all__ = ["copyfileobj","copyfile","copymode","copystat","copy","copy2",
            "copytree","move","rmtree","Error", "SpecialFileError"]
@@ -88,8 +89,11 @@
     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").

Modified: python/branches/release31-maint/Misc/NEWS
==============================================================================
--- python/branches/release31-maint/Misc/NEWS	(original)
+++ python/branches/release31-maint/Misc/NEWS	Mon Mar 22 21:12:40 2010
@@ -17,6 +17,10 @@
 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 #3890: Fix recv() and recv_into() on non-blocking SSL sockets.
 
 - Issue #6716/2: Backslash-replace error output in compilall.


More information about the Python-checkins mailing list