-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Closed as not planned
Closed as not planned
Copy link
Labels
3.12only security fixesonly security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
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.islinkwhen 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 itsonerrorargument. 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.
Metadata
Metadata
Assignees
Labels
3.12only security fixesonly security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error