MCPcopy Index your code
hub / github.com/python/mypy / Unbox

Class Unbox

mypyc/ir/ops.py:1185–1208  ·  view source on GitHub ↗

unbox(type, src) This is similar to a cast, but it also changes to a (potentially) unboxed runtime representation. Only supported for types with an unboxed representation.

Source from the content-addressed store, hash-verified

1183
1184@final
1185class Unbox(RegisterOp):
1186 """unbox(type, src)
1187
1188 This is similar to a cast, but it also changes to a (potentially) unboxed runtime
1189 representation. Only supported for types with an unboxed representation.
1190 """
1191
1192 def __init__(self, src: Value, typ: RType, line: int) -> None:
1193 self.src = src
1194 self.type = typ
1195 if not typ.error_overlap:
1196 self.error_kind = ERR_MAGIC
1197 else:
1198 self.error_kind = ERR_MAGIC_OVERLAPPING
1199 super().__init__(line)
1200
1201 def sources(self) -> list[Value]:
1202 return [self.src]
1203
1204 def set_sources(self, new: list[Value]) -> None:
1205 (self.src,) = new
1206
1207 def accept(self, visitor: OpVisitor[T]) -> T:
1208 return visitor.visit_unbox(self)
1209
1210
1211@final

Callers 6

unbox_or_castMethod · 0.90
test_unbox_intMethod · 0.90
test_unbox_i64Method · 0.90
test_unbox_vecMethod · 0.90
test_unbox_vec_nestedMethod · 0.90

Calls

no outgoing calls

Tested by 4

test_unbox_intMethod · 0.72
test_unbox_i64Method · 0.72
test_unbox_vecMethod · 0.72
test_unbox_vec_nestedMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…