[New-bugs-announce] [issue42014] shutil.rmtree calls onerror with different function than failed

Michal Čihař report at bugs.python.org
Mon Oct 12 08:54:15 EDT 2020


New submission from Michal Čihař <michal at cihar.com>:

The onerror callback is called with os.lstat when the actual failing function is os.open.

To reproduce create directory that can not be listed:

import os
import shutil

def onerror(func, path, exc_info):
    print(func)

os.mkdir("test")
os.chmod("test", 0)
shutil.rmtree("test", onerror=onerror)

----------
components: Library (Lib)
messages: 378495
nosy: nijel
priority: normal
pull_requests: 21642
severity: normal
status: open
title: shutil.rmtree calls onerror with different function than failed
type: behavior
versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42014>
_______________________________________


More information about the New-bugs-announce mailing list