Skip to content

Commit

Permalink
gfc: skip trailing TryEnd if no current TryBegin
Browse files Browse the repository at this point in the history
  • Loading branch information
P403n1x87 committed Oct 19, 2024
1 parent 4892a96 commit 9e3dbdf
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/bytecode/cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,13 @@ def run(self) -> Generator[Union["_StackSizeComputer", int], int, None]:
if instr.is_uncond_jump():
# Check for TryEnd after the final instruction which is possible
# TryEnd being only pseudo instructions
if te := self.block.get_trailing_try_end(i):
if self._current_try_begin is None:
self._current_try_begin = te.entry
else:
# TryBegin cannot be nested
assert te.entry is self._current_try_begin, (te.entry, self._current_try_begin)
if self._current_try_begin is not None and (
te := self.block.get_trailing_try_end(i)
):
assert te.entry is self._current_try_begin, (
te.entry,
self._current_try_begin,
)

assert isinstance(te.entry.target, BasicBlock)
yield from self._compute_exception_handler_stack_usage(
Expand Down

0 comments on commit 9e3dbdf

Please sign in to comment.