Nonlocal control for finally blocks. Just makes sure that sys.exc_info always gets restored when we leave and the return register is decrefed if it isn't null.
| 197 | |
| 198 | |
| 199 | class FinallyNonlocalControl(CleanupNonlocalControl): |
| 200 | """Nonlocal control for finally blocks. |
| 201 | |
| 202 | Just makes sure that sys.exc_info always gets restored when we |
| 203 | leave and the return register is decrefed if it isn't null. |
| 204 | """ |
| 205 | |
| 206 | def __init__(self, outer: NonlocalControl, saved: Value) -> None: |
| 207 | super().__init__(outer) |
| 208 | self.saved = saved |
| 209 | |
| 210 | def gen_cleanup(self, builder: IRBuilder, line: int) -> None: |
| 211 | # Restore the old exc_info |
| 212 | target, cleanup = BasicBlock(), BasicBlock() |
| 213 | builder.add(Branch(self.saved, target, cleanup, Branch.IS_ERROR)) |
| 214 | builder.activate_block(cleanup) |
| 215 | builder.call_c(restore_exc_info_op, [self.saved], line) |
| 216 | builder.goto_and_activate(target) |
no outgoing calls
no test coverage detected
searching dependent graphs…