[issue37366] Add an "onitem" callback parameter to shutil.rmtree()

2019-07-03 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


--
resolution: rejected -> 
versions: +Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37366] Add an "onitem" callback parameter to shutil.rmtree()

2019-07-03 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


--
resolution:  -> rejected

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37366] Add an "onitem" callback parameter to shutil.rmtree()

2019-06-29 Thread Giampaolo Rodola'


Giampaolo Rodola'  added the comment:

I'm gonna reject this one, sorry Jeffrey. Reasons given in 
https://bugs.python.org/issue36422#msg346878 also apply here.

--
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37366] Add an "onitem" callback parameter to shutil.rmtree()

2019-06-28 Thread Christian Heimes


Christian Heimes  added the comment:

I'm with Giampaolo.

I'm also concerned that the new callback will make the rmtree function too 
complicated. It's not a one-size-fits-all solution, but it covers most uses 
cases.

--
nosy: +christian.heimes
versions:  -Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37366] Add an "onitem" callback parameter to shutil.rmtree()

2019-06-28 Thread Jeffrey Kintscher


Jeffrey Kintscher  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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37366] Add an "onitem" callback parameter to shutil.rmtree()

2019-06-27 Thread Giampaolo Rodola'


Giampaolo Rodola'  added the comment:

I am not sure I understand the use case. Other than "unmounting a mount point" 
the other scenarios look unrealistic to me and also require a fd instead of a 
path. Also, if you want to unmount a path you can do so via *onerror* instead 
(unmount + delete). Pre-emptively checking if you have the permission to do 
something is sort of unpythonic and racy.

--
versions:  -Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37366] Add an "onitem" callback parameter to shutil.rmtree()

2019-06-26 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


--
keywords: +patch
pull_requests: +14232
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/14419

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37366] Add an "onitem" callback parameter to shutil.rmtree()

2019-06-21 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


--
versions: +Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37366] Add an "onitem" callback parameter to shutil.rmtree()

2019-06-21 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


--
nosy: +giampaolo.rodola, josh.r, max, paul.moore, riccardomurri, 
serhiy.storchaka, steve.dower, tarek, tim.golden, zach.ware

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37366] Add an "onitem" callback parameter to shutil.rmtree()

2019-06-21 Thread Jeffrey Kintscher


New submission from Jeffrey Kintscher :

Add an "onitem" callback paramter to shutil.rmtree() that, if provided, gets 
called for each directory entry as it is encountered.  This allows the caller 
to perform any required special handling of individual directory entries (e.g. 
unmounting a mount point, closing a file, shutting down a named pipe, etc.) 
before rmtree() attempts to remove them.

This enhancement is related to issue #36422.

--
components: Library (Lib)
messages: 346245
nosy: Jeffrey.Kintscher
priority: normal
severity: normal
status: open
title: Add an "onitem" callback parameter to shutil.rmtree()
type: enhancement
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com