R. David Murray <rdmur...@bitdance.com> added the comment:

If solution 1 is acceptable in the general case, then I think a better fix  
would look like this:

try:
    names = os.listdir(path)
except os.error, err:
    onerror(os.listdir, path, sys.exc_info())
    return

That is, this is another case in which we can't continue even if onerror 
returns.  However, onerror is free to correct the problem and then call rmtree. 
 (The danger, of course, is infinite recursion, but I don't think it is our 
responsibility to protect the author of an onerror handler from that potential 
mistake.)

By analogy to the other place rmtree returns after an onerror call, the above 
fix does fix a real bug, regardless of the disposition of the feature request, 
since currently if onerror returns we get a name error.

----------
components: +Library (Lib) -Extension Modules
keywords: +easy
nosy: +r.david.murray
priority:  -> low
stage:  -> unit test needed
type:  -> behavior
versions: +Python 2.6, Python 2.7, Python 3.1, Python 3.2 -Python 2.5

_______________________________________
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