GH-89727: Fix `shutil.rmtree()` recursion error on deep trees by barneygale · Pull Request #119808 · python/cpython · GitHub

github.com

Tin mới

barneygale:gh-89727-rmtree-safe

miss-islington-app

GitHub CopilotWrite better code with AI

GitHub Copilot appDirect agents from issue to merge

ActionsAutomate any workflow

CodespacesInstant dev environments

IssuesPlan and track work

Code ReviewManage code changes

Code QualityEnforce quality at merge

GitHub Advanced SecurityFind and fix vulnerabilities

Code securitySecure your code as you build

Secret protectionStop leaks before they start

View all use cases

Financial services

View all industries

Software Development

GitHub SponsorsFund open source developers

Copilot for BusinessEnterprise-grade AI features

Premium SupportEnterprise-grade 24/7 support

Pull requests 2.6k

Security and quality 0

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

Tidy up _rmtree_safe_fd() implementation.

Rewrite using list as stack.

needs backport to 3.12

needs backport to 3.13

awaiting core review

Use DirEntry.stat() where possible.

Comments, naming, line limit.

Simplify overall diff

View reviewed changes

Learn more about hiding disruptive comments

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

Address some review feedback

Handle further errors in finally: block

Handle os.close explicitly

View reviewed changes

Skip os.unlink() if os.DirEntry.is_dir() raises FileNotFoundError

View reviewed changes

recursion error on deep trees (

bedevere-app Bot commented Jun 1, 2024
bedevere-app Bot commented Jun 1, 2024

bedevere-app Bot commented Jun 1, 2024

GH-119918 is a backport of this pull request to the 3.13 branch.

recursion error on deep trees (

recursion error on deep …

recursion error on deep trees (

recursion error on deep trees (

recursion error on deep trees (

recursion error on deep trees (

recursion error on deep trees (

Test failure with "shutil.rmtree()" in isolated build environments (1.5.3.rc1 in Fedora 41) bit-team/backintime#1911