MCPcopy Index your code
hub / github.com/RustPython/RustPython / disassemble

Function disassemble

Lib/dis.py:810–833  ·  view source on GitHub ↗

Disassemble a code object.

(co, lasti=-1, *, file=None, show_caches=False, adaptive=False,
                show_offsets=False, show_positions=False)

Source from the content-addressed store, hash-verified

808
809
810def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False,
811 show_offsets=False, show_positions=False):
812 """Disassemble a code object."""
813 linestarts = dict(findlinestarts(co))
814 exception_entries = _parse_exception_table(co)
815 if show_positions:
816 lineno_width = _get_positions_width(co)
817 else:
818 lineno_width = _get_lineno_width(linestarts)
819 labels_map = _make_labels_map(co.co_code, exception_entries=exception_entries)
820 label_width = 4 + len(str(len(labels_map)))
821 formatter = Formatter(file=file,
822 lineno_width=lineno_width,
823 offset_width=len(str(max(len(co.co_code) - 2, 9999))) if show_offsets else 0,
824 label_width=label_width,
825 show_caches=show_caches,
826 show_positions=show_positions)
827 arg_resolver = ArgResolver(co_consts=co.co_consts,
828 names=co.co_names,
829 varname_from_oparg=co._varname_from_oparg,
830 labels_map=labels_map)
831 _disassemble_bytes(_get_code_array(co, adaptive), lasti, linestarts,
832 exception_entries=exception_entries, co_positions=co.co_positions(),
833 original_code=co.co_code, arg_resolver=arg_resolver, formatter=formatter)
834
835def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False, show_offsets=False, show_positions=False):
836 disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive, show_offsets=show_offsets, show_positions=show_positions)

Callers 2

distbFunction · 0.85
_disassemble_recursiveFunction · 0.85

Calls 13

findlinestartsFunction · 0.85
_parse_exception_tableFunction · 0.85
_get_positions_widthFunction · 0.85
_get_lineno_widthFunction · 0.85
_make_labels_mapFunction · 0.85
lenFunction · 0.85
strFunction · 0.85
maxFunction · 0.85
ArgResolverClass · 0.85
_disassemble_bytesFunction · 0.85
_get_code_arrayFunction · 0.85
co_positionsMethod · 0.80

Tested by

no test coverage detected