llvm-project/lldb/bindings/interface/SBProgressExtensions.i
Jacob Lalonde 2f5c836e08
[SBProgress] Add swig support for with statement in Python (#133527)
We recently added an explicit finalize to SBProgress, #128966. I
realized while adding some additional implementations of SBProgress that
we should to add `with` support for ease of use. This patch addresses
adding and `__enter()__` method (which a no-op) and an `__exit()__` to
swig. I also refactor the emitter for the test to leverage `with`
instead of explicitly calling finalize, and I've updated the docstrings.
2025-03-29 15:21:51 -07:00

13 lines
304 B
OpenEdge ABL

%extend lldb::SBProgress {
#ifdef SWIGPYTHON
%pythoncode %{
def __enter__(self):
'''No-op for with statement'''
pass
def __exit__(self, exc_type, exc_value, traceback):
'''Finalize the progress object'''
self.Finalize()
%}
#endif
}