MCPcopy
hub / github.com/rocky/python-uncompyle6 / op_at_code_loc

Function op_at_code_loc

uncompyle6/semantics/fragments.py:2239–2251  ·  view source on GitHub ↗

Return the instruction name at code[loc] using opc to look up instruction names. Returns 'got IndexError' if code[loc] is invalid. `code` is instruction bytecode, `loc` is an offset (integer) and `opc` is an opcode module from `xdis`.

(code, loc, opc)

Source from the content-addressed store, hash-verified

2237
2238
2239def op_at_code_loc(code, loc, opc):
2240 """Return the instruction name at code[loc] using
2241 opc to look up instruction names. Returns 'got IndexError'
2242 if code[loc] is invalid.
2243
2244 `code` is instruction bytecode, `loc` is an offset (integer) and
2245 `opc` is an opcode module from `xdis`.
2246 """
2247 try:
2248 op = code[loc]
2249 except IndexError:
2250 return "got IndexError"
2251 return opc.opname[op]
2252
2253
2254def deparsed_find(tup, deparsed, code):

Callers 1

deparsed_findFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected