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

Class Undef

mypyc/ir/ops.py:254–270  ·  view source on GitHub ↗

An undefined value. Use Undef() as the initial value followed by one or more SetElement ops to initialize a struct. Pseudocode example: r0 = set_element undef MyStruct, "field1", f1 r1 = set_element r0, "field2", f2 # r1 now has new struct value with two fields set W

Source from the content-addressed store, hash-verified

252
253@final
254class Undef(Value):
255 """An undefined value.
256
257 Use Undef() as the initial value followed by one or more SetElement
258 ops to initialize a struct. Pseudocode example:
259
260 r0 = set_element undef MyStruct, "field1", f1
261 r1 = set_element r0, "field2", f2
262 # r1 now has new struct value with two fields set
263
264 Warning: Always initialize undefined values before using them,
265 as otherwise the values are garbage. You shouldn't expect that
266 undefined values are zeroed, in particular.
267 """
268
269 def __init__(self, rtype: RType) -> None:
270 self.type = rtype
271
272
273class Op(Value):

Callers 3

convert_to_t_ext_itemFunction · 0.90
convert_from_t_ext_itemFunction · 0.90
test_set_elementMethod · 0.90

Calls

no outgoing calls

Tested by 1

test_set_elementMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…