MCPcopy Index your code
hub / github.com/python/cpython / findlabels

Function findlabels

Lib/dis.py:971–985  ·  view source on GitHub ↗

Detect all offsets in a byte code which are jump targets. Return the list of offsets.

(code)

Source from the content-addressed store, hash-verified

969 extended_args_offset = 0
970
971def 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
987def findlinestarts(code):
988 """Find the offsets in a byte code which are start of lines in the source.

Callers 1

_make_labels_mapFunction · 0.85

Calls 3

_unpack_opargsFunction · 0.85
_get_jump_targetFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…