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