Closed as not planned
Closed as not planned
Description
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 ofrmtree()
. The implementation already bends the truth, for example supplyingos.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. bytempfile
). What legitimate use cases are there? I propose we remove it! - The second argument,
path
, is already be available viaexc.filename
. This is noted inos.walk()
's documentation of itsonerror
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.