]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] GH-89727: Partially fix `shutil.rmtree()` recursion error on deep trees (GH...
authorBarney Gale <barney.gale@gmail.com>
Wed, 29 May 2024 20:53:08 +0000 (21:53 +0100)
committerGitHub <noreply@github.com>
Wed, 29 May 2024 20:53:08 +0000 (21:53 +0100)
commit45587df8d0a129fb580cdd591f514efb09f49305
tree1b1c2809f390050f6b4cb7ec6e6a00299c33db58
parente9025039801ed9be48b825e6fff614ef3bc7dafb
[3.12] GH-89727: Partially fix `shutil.rmtree()` recursion error on deep trees (GH-119634) (#119749)

* GH-89727: Partially fix `shutil.rmtree()` recursion error on deep trees (#119634)

Make `shutil._rmtree_unsafe()` call `os.walk()`, which is implemented
without recursion.

`shutil._rmtree_safe_fd()` is not affected and can still raise a recursion
error.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit a150679f90c6e3f017bd75cac3b8f727063cc4aa)
Lib/os.py
Lib/shutil.py
Lib/test/test_shutil.py
Misc/NEWS.d/next/Library/2024-05-29-20-42-17.gh-issue-89727.5lPTTW.rst [new file with mode: 0644]