Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-73991: Add pathlib.Path.rmtree() #119060

Merged
merged 23 commits into from
Jul 20, 2024
Merged

Conversation

barneygale
Copy link
Contributor

@barneygale barneygale commented May 15, 2024

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().


📚 Documentation preview 📚: https://cpython-previews--119060.org.readthedocs.build/

Add a `Path.rmtree()` method that removes an entire directory tree using
`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()`.
@barneygale barneygale marked this pull request as draft June 14, 2024 20:09
@barneygale barneygale marked this pull request as ready for review June 19, 2024 00:42
@barneygale barneygale requested a review from zooba July 3, 2024 03:55
Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for that addition by the way. Here are some nitpicking comments.

barneygale and others added 2 commits July 4, 2024 19:33
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@barneygale barneygale enabled auto-merge (squash) July 20, 2024 17:48
@AA-Turner
Copy link
Member

Docs failure is #122068

@barneygale barneygale merged commit 094375b into python:main Jul 20, 2024
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants