From a4bfd757db45f82a409cb554cda9d77ac529140f Mon Sep 17 00:00:00 2001 From: Josh Wiedemeier Date: Fri, 19 Dec 2025 11:16:41 -0600 Subject: [PATCH] fix inlined __annotate__ jumps to return --- pylingual/editable_bytecode/EditableBytecode.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pylingual/editable_bytecode/EditableBytecode.py b/pylingual/editable_bytecode/EditableBytecode.py index e837de8..1e39dd5 100644 --- a/pylingual/editable_bytecode/EditableBytecode.py +++ b/pylingual/editable_bytecode/EditableBytecode.py @@ -157,6 +157,11 @@ class EditableBytecode: inline_dict[(idx, inst)] = inlinable_insts jump_target_mapping[inst] = inlinable_insts[0] + # for jumps in __conditional_annotations__ that go to the omitted return, set them to jump to the next instruction + for new_inst in inlinable_insts: + if new_inst.is_jump and new_inst.target not in inlinable_insts: + jump_target_mapping[new_inst.target] = self.instructions[idx + 1] + self.insert_insts({idx + 1: insts for (idx, inst), insts in inline_dict.items()}) self._change_jump_targets(jump_target_mapping) self.remove_instructions({inst for (idx, inst) in inline_dict.keys()})