Jeffrey Kintscher <websur...@surf2c.net> added the comment:

Yes, onerror allows you to delete an undeletable item.  But, in the case of a 
mount point, the contents of the mounted filesystem get deleted *before* the 
mount point triggers onerror.  This is the case described in issue #36422.

The behavior provided by onitem allows you to provide a callback that can check 
for specific paths that may require special handling.  This is especially 
useful if the onitem callback is also added to tempfile.TemporaryDirectory().

My PR handles a missing onitem argument the same way onerror is handled by 
providing a do-nothing stub function:

if onitem is None:
    def onitem(*args):
        pass

I don't know enough about CPython internals to tell the performance differences 
between such a stub function and wrapping each call to onitem in an "if" block.

----------
versions: +Python 3.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37366>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to