summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/shutil.py2
-rw-r--r--Misc/NEWS.d/next/Library/2020-11-10-15-40-56.bpo-42014.ShM37l.rst1
2 files changed, 2 insertions, 1 deletions
diff --git a/Lib/shutil.py b/Lib/shutil.py
index 9d15149..6986bce 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -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)):
diff --git a/Misc/NEWS.d/next/Library/2020-11-10-15-40-56.bpo-42014.ShM37l.rst b/Misc/NEWS.d/next/Library/2020-11-10-15-40-56.bpo-42014.ShM37l.rst
new file mode 100644
index 0000000..d3e1abc
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-11-10-15-40-56.bpo-42014.ShM37l.rst
@@ -0,0 +1 @@
+The ``onerror`` callback from ``shutil.rmtree`` now receives correct function when ``os.open`` fails. \ No newline at end of file