diff options
author | Barney Gale <barney.gale@gmail.com> | 2024-07-20 20:14:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-20 20:14:13 (GMT) |
commit | 094375b9b7e087a4f0f60541dc7f2dc53be92646 (patch) | |
tree | 77078617f44b03e728d48c7ade0b6986c6ef40d3 /Misc | |
parent | 8db5f480072421bb065d346c3bbc5e88fc368587 (diff) | |
download | cpython-094375b9b7e087a4f0f60541dc7f2dc53be92646.zip cpython-094375b9b7e087a4f0f60541dc7f2dc53be92646.tar.gz cpython-094375b9b7e087a4f0f60541dc7f2dc53be92646.tar.bz2 |
GH-73991: Add `pathlib.Path.rmtree()` (#119060)
Add a `Path.rmtree()` method that removes an entire directory tree, like
`shutil.rmtree()`. The signature of the optional *on_error* argument
matches the `Path.walk()` argument of the same name, but differs from the
*onexc* and *onerror* arguments to `shutil.rmtree()`. Consistency within
pathlib is probably more important.
In the private pathlib ABCs, we add an implementation based on `walk()`.
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Library/2024-05-15-01-21-44.gh-issue-73991.bNDqQN.rst | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2024-05-15-01-21-44.gh-issue-73991.bNDqQN.rst b/Misc/NEWS.d/next/Library/2024-05-15-01-21-44.gh-issue-73991.bNDqQN.rst new file mode 100644 index 0000000..9aa7a7d --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-05-15-01-21-44.gh-issue-73991.bNDqQN.rst @@ -0,0 +1 @@ +Add :meth:`pathlib.Path.rmtree`, which recursively removes a directory. |