Message305640
The documentation says “On . . . destruction of the temporary directory object the newly created temporary directory and all its contents are removed”. If you had enabled warnings, you may have seen a hint:
$ python -Wdefault -c 'import tempfile; print(tempfile.TemporaryDirectory().name)'
/usr/lib/python3.5/tempfile.py:788: ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/tmp/tmpj6100h57'>
_warnings.warn(warn_message, ResourceWarning)
/tmp/tmpj6100h57
This is similar in spirit to earlier bug reports where workarounds were added, but to avoid this instance of the problem the string object returned by the “name” attribute would have to hold a reference back to the directory object.
* Issue 23700: iter(NamedTemporaryFile())
* Issue 18879: NamedTemporaryFile().write(...) |
|
Date |
User |
Action |
Args |
2017-11-06 12:43:25 | martin.panter | set | recipients:
+ martin.panter, Adam Dangoor |
2017-11-06 12:43:25 | martin.panter | set | messageid: <1509972205.18.0.213398074469.issue31959@psf.upfronthosting.co.za> |
2017-11-06 12:43:25 | martin.panter | link | issue31959 messages |
2017-11-06 12:43:25 | martin.panter | create | |
|