Skip to content
Commit fb6b4c1b authored by Douglas Raillard's avatar Douglas Raillard
Browse files

lisa.trace: Make Trace a context manager

FEATURE

lisa.trace.Trace objects have to manage some cache-related resources,
which can require orderly cleanup in some situations (e.g. if the caller
intends on removing the trace.dat folder after it is done with the
Trace). Relying on __del__ for that does not work as cyclic references
to the Trace instance make __del__ execute at an unknown point in the
future.

Fix that by providing a context manager API to Trace, which can be used
in this sort of situation. The cleanup code will still attempt to run on
__del__ if it has not run yet for backward compatibility and simpler
situations.
parent 0f406d31
Loading
Loading
Loading
Loading
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