The onexc argument was added two weeks ago to replace onerror: d51a6dc
Though it improves the third argument (replacing a 3-tuple with the exception object), I think we should also consider two further improvements while we're in the business of replacing onerror, as the opportunity may not come again for a long time:
- The first argument, function, provides an unreasonably deep insight into the internals of rmtree(). The implementation already bends the truth, for example supplying os.path.islink when a junction check fails. Error reporting can already be achieved by printing or re-raising the exception. It's not used in the standard library (e.g. by tempfile). What legitimate use cases are there? I propose we remove it!
- The second argument, path, is already be available via exc.filename. This is noted in os.walk()'s documentation of its onerror argument. Also propose we remove it.
If we make onexc accept a single argument, it would align with the onerror argument to os.walk() and os.fwalk(), and provide more relevant (/less redundant) information.
Reactions are currently unavailable
The onexc argument was added two weeks ago to replace onerror: d51a6dc
Though it improves the third argument (replacing a 3-tuple with the exception object), I think we should also consider two further improvements while we're in the business of replacing onerror, as the opportunity may not come again for a long time:
If we make onexc accept a single argument, it would align with the onerror argument to os.walk() and os.fwalk(), and provide more relevant (/less redundant) information.