8000 bpo-42014: shutil.rmtree: call onerror with correct function (GH-22585) · python/cpython@e59b2de · GitHub
[go: up one dir, main page]

Skip to content

Commit e59b2de

Browse files
authored
bpo-42014: shutil.rmtree: call onerror with correct function (GH-22585)
The onerror is supposed to be called with failed function, but in this case lstat is wrongly used instead of open. Not sure if this needs bug or not... Automerge-Triggered-By: GH:hynek
1 parent 3eb2846 commit e59b2de

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Lib/shutil.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ def onerror(*args):
711711
try:
712712
fd = os.open(path, os.O_RDONLY)
713713
except Exception:
714-
onerror(os.lstat, path, sys.exc_info())
714+
onerror(os.open, path, sys.exc_info())
715715
return
716716
try:
717717
if os.path.samestat(orig_st, os.fstat(fd)):
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The ``onerror`` callback from ``shutil.rmtree`` now receives correct function when ``os.open`` fails.

0 commit comments

Comments
 (0)
0