[Python-checkins] r79299 - in python/trunk: Lib/shutil.py Misc/NEWS

Tarek Ziadé ziade.tarek at gmail.com
Mon Mar 22 21:05:02 CET 2010


I think we should have a unit test to cover that case, I am willing to
add it since I took the maintenance of this module.
You can put me in charge of the issue if you close it, so I can track
that change


On Mon, Mar 22, 2010 at 3:59 PM, antoine.pitrou
<python-checkins at python.org> wrote:
> Author: antoine.pitrou
> Date: Mon Mar 22 20:59:46 2010
> New Revision: 79299
>
> Log:
> 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/trunk/Lib/shutil.py
>   python/trunk/Misc/NEWS
>
> Modified: python/trunk/Lib/shutil.py
> ==============================================================================
> --- python/trunk/Lib/shutil.py  (original)
> +++ python/trunk/Lib/shutil.py  Mon Mar 22 20:59:46 2010
> @@ -11,6 +11,7 @@
>  import fnmatch
>  from warnings import warn
>  import collections
> +import errno
>
>  try:
>     from pwd import getpwnam
> @@ -105,8 +106,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, 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/trunk/Misc/NEWS
> ==============================================================================
> --- python/trunk/Misc/NEWS      (original)
> +++ python/trunk/Misc/NEWS      Mon Mar 22 20:59:46 2010
> @@ -29,6 +29,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 #7703: ctypes supports both buffer() and memoryview().  The former is
>   deprecated.
>
> _______________________________________________
> Python-checkins mailing list
> Python-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-checkins
>



-- 
Tarek Ziadé | http://ziade.org


More information about the Python-checkins mailing list