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
(cherry picked from commit
e59b2deffde61e5641cabd65034fa11b4db898ba)
Co-authored-by: Michal Čihař <michal@cihar.com>
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)):
--- /dev/null
+The ``onerror`` callback from ``shutil.rmtree`` now receives correct function when ``os.open`` fails.
\ No newline at end of file