Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/bytecode/cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,6 @@ def compute_stacksize(
if compute_exception_stack_depths:
for tb in common.try_begins:
size = common.exception_block_startsize[id(tb.target)]
assert size >= 0
tb.stack_depth = size

return args
Expand Down Expand Up @@ -841,7 +840,6 @@ def from_bytecode(bytecode: _bytecode.Bytecode) -> "ControlFlowGraph":
# The last instruction is final, if the current instruction is a
# TryEnd insert it in the same block and move to the next instruction
if last_instr.is_final() and isinstance(instr, TryEnd):
assert active_try_begin
nte = instr.copy()
nte.entry = try_begins[active_try_begin][-1]
old_block.append(nte)
Expand Down Expand Up @@ -888,7 +886,6 @@ def from_bytecode(bytecode: _bytecode.Bytecode) -> "ControlFlowGraph":
if isinstance(instr, (Instr, TryBegin, TryEnd)):
new = instr.copy()
if isinstance(instr, TryBegin):
assert active_try_begin is None
active_try_begin = instr
try_begin_inserted_in_block = True
assert isinstance(new, TryBegin)
Expand Down Expand Up @@ -982,9 +979,7 @@ def to_bytecode(self) -> _bytecode.Bytecode:
# If due to jumps and split TryBegin, we encounter a TryBegin
# while we still have a TryBegin ensure they can be fused.
if last_try_begin is not None:
cfg_tb, byt_tb = last_try_begin
assert instr.target is cfg_tb.target
assert instr.push_lasti == cfg_tb.push_lasti
_, byt_tb = last_try_begin
byt_tb.stack_depth = min(
byt_tb.stack_depth, instr.stack_depth
)
Expand All @@ -1003,7 +998,6 @@ def to_bytecode(self) -> _bytecode.Bytecode:
# If we did not yet compute the required stack depth
# keep the value as UNSET
if entry.stack_depth is UNSET:
assert instr.stack_depth is UNSET
byt_te.entry.stack_depth = UNSET
else:
byt_te.entry.stack_depth = min(
Expand Down
Loading
Loading