MCPcopy Create free account
hub / github.com/python/mypy / ExceptNonlocalControl

Class ExceptNonlocalControl

mypyc/irbuild/nonlocalcontrol.py:184–196  ·  view source on GitHub ↗

Nonlocal control for except blocks. Just makes sure that sys.exc_info always gets restored when we leave. This is super annoying.

Source from the content-addressed store, hash-verified

182
183
184class ExceptNonlocalControl(CleanupNonlocalControl):
185 """Nonlocal control for except blocks.
186
187 Just makes sure that sys.exc_info always gets restored when we leave.
188 This is super annoying.
189 """
190
191 def __init__(self, outer: NonlocalControl, saved: Value | AssignmentTarget) -> None:
192 super().__init__(outer)
193 self.saved = saved
194
195 def gen_cleanup(self, builder: IRBuilder, line: int) -> None:
196 builder.call_c(restore_exc_info_op, [builder.read(self.saved, line)], line)
197
198
199class FinallyNonlocalControl(CleanupNonlocalControl):

Callers 2

transform_try_exceptFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…