Detect all offsets in a byte code which are jump targets. Return the list of offsets.
(code)
| 963 | extended_args_offset = 0 |
| 964 | |
| 965 | def findlabels(code): |
| 966 | """Detect all offsets in a byte code which are jump targets. |
| 967 | |
| 968 | Return the list of offsets. |
| 969 | |
| 970 | """ |
| 971 | labels = [] |
| 972 | for offset, _, op, arg in _unpack_opargs(code): |
| 973 | if arg is not None: |
| 974 | label = _get_jump_target(op, arg, offset) |
| 975 | if label is None: |
| 976 | continue |
| 977 | if label not in labels: |
| 978 | labels.append(label) |
| 979 | return labels |
| 980 | |
| 981 | def findlinestarts(code): |
| 982 | """Find the offsets in a byte code which are start of lines in the source. |
no test coverage detected