Skip to content
Snippets Groups Projects
Commit 6381a641 authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Add SuppressedWarnings context mgr

parent df794442
No related branches found
No related tags found
No related merge requests found
......@@ -1238,4 +1238,17 @@ def make_zero_and_vars(set_vars, params=[], ctx=None):
return result
class SuppressedWarnings:
def __init__(self, ctx):
self.ctx = ctx
def __enter__(self):
self.prev_on_error = self.ctx.get_on_error()
self.ctx.set_on_error(on_error.CONTINUE)
def __exit__(self, type, value, traceback):
self.ctx.set_on_error(self.prev_on_error)
# vim: foldmethod=marker
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