MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / get_instructions

Function get_instructions

tools/python-3.11.9-amd64/Lib/dis.py:330–352  ·  view source on GitHub ↗

Iterator for the opcodes in methods, functions or code Generates a series of Instruction named tuples giving the details of each operations in the supplied code. If *first_line* is not None, it indicates the line number that should be reported for the first source line in the

(x, *, first_line=None, show_caches=False, adaptive=False)

Source from the content-addressed store, hash-verified

328
329
330def get_instructions(x, *, first_line=None, show_caches=False, adaptive=False):
331 """Iterator for the opcodes in methods, functions or code
332
333 Generates a series of Instruction named tuples giving the details of
334 each operations in the supplied code.
335
336 If *first_line* is not None, it indicates the line number that should
337 be reported for the first source line in the disassembled code.
338 Otherwise, the source line information (if any) is taken directly from
339 the disassembled code object.
340 """
341 co = _get_code_object(x)
342 linestarts = dict(findlinestarts(co))
343 if first_line is not None:
344 line_offset = first_line - co.co_firstlineno
345 else:
346 line_offset = 0
347 return _get_instructions_bytes(_get_code_array(co, adaptive),
348 co._varname_from_oparg,
349 co.co_names, co.co_consts,
350 linestarts, line_offset,
351 co_positions=co.co_positions(),
352 show_caches=show_caches)
353
354def _get_const_value(op, arg, co_consts):
355 """Helper to get the value of the const in a hasconst op.

Callers

nothing calls this directly

Calls 4

_get_code_objectFunction · 0.85
findlinestartsFunction · 0.85
_get_instructions_bytesFunction · 0.85
_get_code_arrayFunction · 0.85

Tested by

no test coverage detected