Title: Callable supplied to `shutil.rmtree(onexc=...)` should accept a single argument · Issue #103218 · python/cpython · GitHub
Open Graph Title: Callable supplied to `shutil.rmtree(onexc=...)` should accept a single argument · Issue #103218 · python/cpython
X Title: Callable supplied to `shutil.rmtree(onexc=...)` should accept a single argument · Issue #103218 · python/cpython
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 bus...
Open Graph 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 fur...
X 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 fur...
Opengraph URL: https://github.com/python/cpython/issues/103218
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Callable supplied to `shutil.rmtree(onexc=...)` should accept a single argument","articleBody":"The `onexc` argument was added two weeks ago to replace `onerror`: d51a6dc28e1b2cd0353a78bd13f46e288fa39aa6\r\n\r\nThough 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:\r\n\r\n1. 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!\r\n2. 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.\r\n\r\nIf 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.","author":{"url":"https://github.com/barneygale","@type":"Person","name":"barneygale"},"datePublished":"2023-04-03T18:14:49.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/103218/cpython/issues/103218"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4ab1dba1-a862-4e71-8e16-8b20a6aebe47 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BD22:2EC95F:2594158:34F5DA3:69691BDE |
| html-safe-nonce | 1dd1d9fed94c60402ced6d89838fe9ff82bd8ea8d9de5035975d51989cfdde8a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRDIyOjJFQzk1RjoyNTk0MTU4OjM0RjVEQTM6Njk2OTFCREUiLCJ2aXNpdG9yX2lkIjoiMTQyNDEyNzQwOTU1NDc5MTM5MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 66de28fbfd2bdb891ccb537fcb9b8ed1dcdd2f0c2a26ff2aa4594bd7ec5bd252 |
| hovercard-subject-tag | issue:1652541350 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/103218/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3544338369fabcbcbc093d50b2a3d013705a65ef3204ac7238116307e01d5046/python/cpython/issues/103218 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3544338369fabcbcbc093d50b2a3d013705a65ef3204ac7238116307e01d5046/python/cpython/issues/103218 |
| og:image:alt | 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 fur... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | barneygale |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0e60568924309a021b51adabdce15c2a2f285b556f3130d1a2fa2a5bce11c55f |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | dd206f7ed6207863172be4a783826e86bd2375c3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width