diff --git a/src/api/python/z3/z3.py b/src/api/python/z3/z3.py index d029769e064..7551d8a2024 100644 --- a/src/api/python/z3/z3.py +++ b/src/api/python/z3/z3.py @@ -6955,6 +6955,13 @@ def __del__(self): if self.solver is not None and self.ctx.ref() is not None and Z3_solver_dec_ref is not None: Z3_solver_dec_ref(self.ctx.ref(), self.solver) + def __enter__(self): + self.push() + return self + + def __exit__(self, *exc_info): + self.pop() + def set(self, *args, **keys): """Set a configuration option. The method `help()` return a string containing all available options.