MCPcopy
hub / github.com/rocky/python-uncompyle6 / next_except_jump

Method next_except_jump

uncompyle6/scanners/scanner3.py:1502–1535  ·  view source on GitHub ↗

Return the next jump that was generated by an except SomeException: construct in a try...except...else clause or None if not found.

(self, start)

Source from the content-addressed store, hash-verified

1500 return offset > self.get_target(offset, extended_arg)
1501
1502 def next_except_jump(self, start):
1503 """
1504 Return the next jump that was generated by an except SomeException:
1505 construct in a try...except...else clause or None if not found.
1506 """
1507
1508 if self.code[start] == self.opc.DUP_TOP:
1509 except_match = self.first_instr(
1510 start, len(self.code), self.opc.POP_JUMP_IF_FALSE
1511 )
1512 if except_match:
1513 jmp = self.prev_op[self.get_target(except_match)]
1514 self.ignore_if.add(except_match)
1515 self.not_continue.add(jmp)
1516 return jmp
1517
1518 count_END_FINALLY = 0
1519 count_SETUP_ = 0
1520 for i in self.op_range(start, len(self.code)):
1521 op = self.code[i]
1522 if op == self.opc.END_FINALLY:
1523 if count_END_FINALLY == count_SETUP_:
1524 assert self.code[self.prev_op[i]] in frozenset(
1525 [
1526 self.opc.JUMP_ABSOLUTE,
1527 self.opc.JUMP_FORWARD,
1528 self.opc.RETURN_VALUE,
1529 ]
1530 )
1531 self.not_continue.add(self.prev_op[i])
1532 return self.prev_op[i]
1533 count_END_FINALLY += 1
1534 elif op in self.setup_opts_no_loop:
1535 count_SETUP_ += 1
1536
1537 def rem_or(self, start, end, instr, target=None, include_beyond_target=False):
1538 """

Callers

nothing calls this directly

Calls 4

first_instrMethod · 0.80
get_targetMethod · 0.80
addMethod · 0.80
op_rangeMethod · 0.80

Tested by

no test coverage detected