New submission from Max:

There's a known issue with `shutil.rmtree` on Windows, in that it fails 
intermittently. 

The issue is well known 
(https://mail.python.org/pipermail/python-dev/2013-September/128353.html), and 
the agreement is that it cannot be cleanly solved inside `shutil` and should 
instead be solved by the calling app. Specifically, python devs themselves 
faced it in their test suite and solved it by retrying delete.

However, what to do about `tempfile.TemporaryDirectory`? Is it considered the 
calling app, and therefore should retry delete when it calls `shutil.rmtree` in 
its `cleanup` method?

I don't think `tempfile` is protected by the same argument that `shutil.rmtree` 
is protected, in that it's too messy to solve it in the standard library. My 
rationale is that while it's very easy for the end user to retry 
`shutil.rmtree`, it's far more difficult to fix the problem with 
`tempfile.TempDirectory` not deleting itself - how would the end user retry the 
`cleanup` method (which is called from `weakref.finalizer`)?

So perhaps the retry loop should be added to `cleanup`.

----------
components: Library (Lib)
messages: 291130
nosy: max
priority: normal
severity: normal
status: open
title: tempfile.TemporaryDirectory fails to delete itself
type: behavior
versions: Python 3.6

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

Reply via email to