[New-bugs-announce] [issue38300] Documentation says destuction of TemporaryDirectory object will also delete it, but it does not.

Ian report at bugs.python.org
Fri Sep 27 15:45:13 EDT 2019


New submission from Ian <iarp.comptech at gmail.com>:

The documentation found here https://docs.python.org/3.7/library/tempfile.html#tempfile.TemporaryDirectory states the following

"On completion of the context or destruction of the temporary directory object the newly created temporary directory and all its contents are removed from the filesystem."

However calling del on the object does not call the cleanup method.

t = tempfile.TemporaryDirectory()
del t

I'm not sure if that is incorrect documentation or my own misunderstanding of what you call destruction. I tested adding my own def __del__(): self.cleanup() which worked as I expected.

----------
messages: 353393
nosy: iarp
priority: normal
severity: normal
status: open
title: Documentation says destuction of TemporaryDirectory object will also delete it, but it does not.
type: behavior
versions: Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38300>
_______________________________________


More information about the New-bugs-announce mailing list