MCPcopy Create free account
hub / github.com/python/mypy / vec_get_item

Function vec_get_item

mypyc/irbuild/vec.py:314–325  ·  view source on GitHub ↗

Generate inlined vec __getitem__ call. We inline this, since it's simple but performance-critical.

(
    builder: LowLevelIRBuilder, base: Value, index: Value, line: int, *, can_borrow: bool = False
)

Source from the content-addressed store, hash-verified

312
313
314def vec_get_item(
315 builder: LowLevelIRBuilder, base: Value, index: Value, line: int, *, can_borrow: bool = False
316) -> Value:
317 """Generate inlined vec __getitem__ call.
318
319 We inline this, since it's simple but performance-critical.
320 """
321 # TODO: Support more item types
322 # TODO: Support more index types
323 len_val = vec_len(builder, base)
324 index = vec_check_and_adjust_index(builder, len_val, index, line)
325 return vec_get_item_unsafe(builder, base, index, line, can_borrow=can_borrow)
326
327
328def vec_get_item_unsafe(

Callers 2

get_itemMethod · 0.90

Calls 3

vec_lenFunction · 0.85
vec_get_item_unsafeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…