You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TemporaryDirectory.__delete__ gained a delete parameter to support retaining temporary files for diagnostic purposes.
In a running system, you may wish gather diagnostic files on failure, or when a specific signal is received. Supporting this fully requires allowing the decision of whether to delete files to be made after the TemporaryDirectory has been __enter__ed.
Assigning to _delete can achieve this effect, but _delete is not part of the public interface.
Therefore, I propose changing TemporaryDirectory._delete to TemporaryDirectory.delete.
We can always turn delete into a property if necessary
Users can provide subclasses of TemporaryDirectory to achieve this
Temporary Directory doesn't have enough of a public API for this to be viable. Using the private API would be morally equivalent to modifying _delete, and modifying _delete would be easier.
Users can provide a wrapper to prevent __exit__ from being called
__del__ might be implemented in the future, as it is for TemporaryFile.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
The text was updated successfully, but these errors were encountered:
Feature or enhancement
Proposal:
TemporaryDirectory.__delete__
gained adelete
parameter to support retaining temporary files for diagnostic purposes.In a running system, you may wish gather diagnostic files on failure, or when a specific signal is received. Supporting this fully requires allowing the decision of whether to delete files to be made after the
TemporaryDirectory
has been__enter__
ed.Assigning to
_delete
can achieve this effect, but_delete
is not part of the public interface.Therefore, I propose changing
TemporaryDirectory._delete
toTemporaryDirectory.delete
.Example use to retain temporary files on error:
Alternatives considered:
delete
into a property if necessary_delete
, and modifying_delete
would be easier.__exit__
from being called__del__
might be implemented in the future, as it is forTemporaryFile
.Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
The text was updated successfully, but these errors were encountered: