Skip to content
Snippets Groups Projects
Commit ee581fd6 authored by Chris Lamb's avatar Chris Lamb :eyes:
Browse files

Clarify in a comment that __del__ is not always called, so temporary...

Clarify in a comment that __del__ is not always called, so temporary directories are not neccessary removed the *moment* they go out of scope.

At least in CPython...

Ref: #234
parent 6a4b63a6
No related branches found
No related tags found
No related merge requests found
......@@ -47,10 +47,12 @@ def get_temporary_directory(*args, **kwargs):
statement. Otherwise it's cleaned up when the object is garbage collected.
WARNING, don't do this:
tmpdir = get_temporary_directory().name
This will result in the immediate removal of the directory, as there is no
reference pointing to the TemporaryDirectory object.
... as this may result in the removal of the directory at some unexpected
time in the future. (Or not at all, depending on whether there are other,
unexpected, references to this instance.)
"""
kwargs["dir"] = kwargs.pop("dir", _get_base_temporary_directory())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment