GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [WIP] GH-89727: Fix `shutil.rmtree()` recursion error on deep trees. by barneygale · Pull Request #103164 · python/cpython

Conversation

@barneygale

@barneygale barneygale commented Apr 1, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Add a follow_junctions argument to pathlib.Path.walk(). When set to false, directory junctions are treated as files.

Add an _fwalk() method to pathlib.Path, similar to os.fwalk() except in its treatment of symlinks.

(This method could be made public in future if desired).

Implement shutil.rmtree() using pathlib.Path.walk() or _fwalk().

  • Issue: Change shutil.rmtree and os.walk to support very deep hierarchies #89727

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@barneygale
pythonGH-89727: Fix shutil.rmtree() recursion error on deep trees.
17f02bb
Add a `follow_junctions` argument to `pathlib.Path.walk()`. When set to
false, directory junctions are treated as files.

Add an `fwalk()` method to `pathlib.Path`, analogous to `os.fwalk()`.

Implement `shutil.rmtree()` using `pathlib.Path.walk()` and `fwalk()`.
@bedevere-bot bedevere-bot mentioned this pull request Apr 1, 2023
Change shutil.rmtree and os.walk to support very deep hierarchies #89727
Open
@bedevere-bot bedevere-bot added the awaiting core review label Apr 1, 2023
barneygale added 26 commits April 1, 2023 02:40
@barneygale
Delay urllib import
48dc5db
@barneygale
Fix up filenames in exceptions
6e92b27
@barneygale
Restore shutil._rmtree_islink()
c042220
@barneygale
Tidy up exception handling
e268e89
@barneygale
Better compatibility with shutil tests.
3f40cb0
@barneygale
Move main implementation into pathlib
b59bda8
@barneygale
Make _fwalk() private, tidy up naming.
c174376
@barneygale
Fix tests
0e8d8e6
@barneygale
Fix missing filename in exception, tidy up more naming.
fea58ab
@barneygale
More cleanup
bff0f5e
@barneygale
Even more tidy-up
3b21684
@barneygale
Reduce diff a bit
5abee55
@barneygale
Performance improvements
57173d9
@barneygale
Simplify rmtree (h/t eryksun)
58070d9
@barneygale
More performance tweaks
d61baa1
@barneygale
Make error._func private, as it's only intended for shutil.rmtree()
e983dd7
@barneygale
Improve tests
5387d32
@barneygale
Improve performance
75541fb
@barneygale
Merge branch 'main' into pathlib-fwalk
698db60
@barneygale
Supply relative paths to rmdir() in fd-based walk.
74cdd6c
@barneygale
Handle rmdir() and unlink() not accepting dir_fd
c17d07c
@barneygale
Move rmtree() implementation back into shutil.
b4f120c
@barneygale
Restore missing dir_fd check
e856ccb
@barneygale
Remove unnecessary change to test
d1e349c
@barneygale
Reduce memory usage a bit.
63e55e1
@barneygale
Reduce diff
f7c5352
arhadthedev
arhadthedev reviewed Apr 12, 2023
View reviewed changes
Comment thread Lib/shutil.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@barneygale

barneygale commented Nov 22, 2023

Copy link
Copy Markdown
Contributor Author

Withdrawing this PR - it's out of date, and I'd like to keep the Path API stable until PathBase is made public (see #110109)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@barneygale barneygale closed this Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@arhadthedev arhadthedev arhadthedev left review comments
@giampaolo giampaolo Awaiting requested review from giampaolo giampaolo will be requested when the pull request is marked ready for review giampaolo is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting core review

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@barneygale @arhadthedev @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.