This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author swalker
Recipients swalker
Date 2010-02-19.22:04:15
SpamBayes Score 1.3362644e-12
Marked as misclassified No
Message-id <1266617058.24.0.24785922897.issue7969@psf.upfronthosting.co.za>
In-reply-to
Content
The error handling present in the implementation of shutil.copytree in python 2.6.4 (and perhaps other versions) is non-standard and partially broken.

In particular, I'm unable to find any pydoc documentation that indicates that when copytree raises shutil.Error, that the error instead of the standard 2-tuple or 3-tuple was initialised with a list of entries.

This means that callers catching EnvironmentError will be in for a surprise whenever they check e.args and find a tuple containing a list instead of just a tuple.

Callers will also be disappointed to find that the entries in the list may be tuples or strings due to what looks like a bug in copystat error handling (it's using extend instead of append).

I could possibly live with this behaviour somewhat if it was actually documented and consistent since shutil.Error can be caught specifically instead.

It's also really unfortunate that the tuples that are stored here aren't the actual exception objects of the errors encountered so callers cannot perform more granular error handling (permissions exceptions, etc.).

I'd like to request that this function:

* be fixed to append copystat errors correctly

* have shutil.Error documentation indicate the special args format and explain how it might be parsed

* consider having it record the exception objects instead of the exception message

* suggest that the default str() output for shutil.Error be improved
History
Date User Action Args
2010-02-19 22:04:18swalkersetrecipients: + swalker
2010-02-19 22:04:18swalkersetmessageid: <1266617058.24.0.24785922897.issue7969@psf.upfronthosting.co.za>
2010-02-19 22:04:16swalkerlinkissue7969 messages
2010-02-19 22:04:15swalkercreate