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

Function _get_code_position

Lib/traceback.py:424–428  ·  view source on GitHub ↗
(code, instruction_index)

Source from the content-addressed store, hash-verified

422
423
424def _get_code_position(code, instruction_index):
425 if instruction_index < 0:
426 return (None, None, None, None)
427 positions_gen = code.co_positions()
428 return next(itertools.islice(positions_gen, instruction_index // 2, None))
429
430
431_RECURSIVE_CUTOFF = 3 # Also hardcoded in traceback.c.

Callers 1

Calls 3

nextFunction · 0.85
co_positionsMethod · 0.80
isliceMethod · 0.80

Tested by

no test coverage detected