mirror of
https://github.com/AdaCore/cpython.git
synced 2026-02-12 12:57:15 -08:00
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
This commit is contained in:
@@ -711,7 +711,7 @@ def rmtree(path, ignore_errors=False, onerror=None):
|
||||
try:
|
||||
fd = os.open(path, os.O_RDONLY)
|
||||
except Exception:
|
||||
onerror(os.lstat, path, sys.exc_info())
|
||||
onerror(os.open, path, sys.exc_info())
|
||||
return
|
||||
try:
|
||||
if os.path.samestat(orig_st, os.fstat(fd)):
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
The ``onerror`` callback from ``shutil.rmtree`` now receives correct function when ``os.open`` fails.
|
||||
Reference in New Issue
Block a user