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
The tempfile.mkdtemp() is used in many places in the code to create a temporary directory, that is later cleaned up manually (e.g. with shutil.rmtree). The drawback of this is that the cleanup will not happen if execution is somehow interruped.
By using tempfile.TemporaryDirectory() instead (even when a context manager cannot be used), cleanup will happen when the garbage collector picks up the object. The "manual" cleanup should still be kept, as calling the .cleanup() method - because the garbage collector doesn't run at predictable intervals.
The
tempfile.mkdtemp()
is used in many places in the code to create a temporary directory, that is later cleaned up manually (e.g. withshutil.rmtree
). The drawback of this is that the cleanup will not happen if execution is somehow interruped.By using
tempfile.TemporaryDirectory()
instead (even when a context manager cannot be used), cleanup will happen when the garbage collector picks up the object. The "manual" cleanup should still be kept, as calling the.cleanup()
method - because the garbage collector doesn't run at predictable intervals.See comment by @ltalirz in #4220 (comment)_
The text was updated successfully, but these errors were encountered: