classification
Title: shutil.rmtree calls onerror with different function than failed
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: giampaolo.rodola, hynek, nijel, serhiy.storchaka, tarek
Priority: normal Keywords:

Created on 2020-10-12 12:54 by nijel, last changed 2020-10-14 09:16 by serhiy.storchaka.

Pull Requests
URL Status Linked Edit
PR 22585 open nijel, 2020-10-12 12:54
Messages (2)
msg378495 - (view) Author: Michal Čihař (nijel) * Date: 2020-10-12 12:54
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)
msg378610 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-10-14 09:16
Added Hynek, the original committer of this code.
History
Date User Action Args
2020-10-14 09:16:03serhiy.storchakasetnosy: + hynek, serhiy.storchaka, tarek, giampaolo.rodola

messages: + msg378610
versions: - Python 3.5, Python 3.6, Python 3.7
2020-10-12 12:54:15nijelcreate