Tarek Ziadé <ziade.ta...@gmail.com> added the comment:

> Well, I don't think removing the current onerror support is a viable 
> option for backward compatibility reasons, 
> so we might as well fix it.  

The options could be deprecated since the new behavior would *return* errors.

> Do you have some use cases in mind, Tarek?

What I have in mind is robustness and simplicity: 

robustness because rmtree() will stop calling third party code that can 
possibly fail and blow the whole process, while working at removing the tree. 

Simplicity because, if it fails at removing some files using the usual os.* 
APIs, it will just return these errors.

Having this two phases-process will ensure that rmtree() did all that was 
possible to remove files.

And as I said previously, I am curious to know what is going to be done in the 
onerror() function when something fails in rmtree(). I doubt any third-party 
code will do better.

This statement "I couldn't copy this file, try it yourself" seems doomed to 
complexity.

If the only use case for onerror() is to silent failures, returning these 
failures seem quite enough. Ala smtp when you get back a list of mails that 
couldn't be send: it doesn't ask you to send them by yourself, just informs you.

Now maybe we do miss some APIs to check for a file tree sanity, like:

- are the permissions the same throughout the tree ?
- is there any link that will make rmtree() fail ? 
- etc/

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8523>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to