◐ Shell
clean mode source ↗

GH-73991: Prune `pathlib.Path.delete()` arguments by barneygale · Pull Request #123158 · python/cpython

Remove the *ignore_errors* and *on_error* arguments from `Path.delete()`.
This functionality was carried over from `shutil`, but its design needs to
be re-considered in its new context. For example, we may wish to support a
*missing_ok* argument (like `Path.unlink()`), or automatically `chmod()`
and retry operations when we hit a permission error (like
`tempfile.TemporaryDirectory`), or retry operations with a backoff (like
`test.support.os_helper.rmtree()`), or utilise exception groups, etc. It's
best to leave our options open for now.

@barneygale

@barneygale barneygale changed the title GH-73991: Prune pathlib.Path.delete() GH-73991: Prune pathlib.Path.delete() arguments

Aug 21, 2024

barneygale added a commit to barneygale/cpython that referenced this pull request

Aug 25, 2024
Per feedback from Paul Moore on pythonGH-123158, it's better to defer making
`Path.delete()` public than ship it with under-designed error handling
capabilities.

We leave a remnant `_delete()` method, which is used by `move()`. Any
functionality not needed by `move()` is deleted.

barneygale added a commit that referenced this pull request

Aug 26, 2024
Per feedback from Paul Moore on GH-123158, it's better to defer making
`Path.delete()` public than ship it with under-designed error handling
capabilities.

We leave a remnant `_delete()` method, which is used by `move()`. Any
functionality not needed by `move()` is deleted.