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

Function insert_overlapping_error_value_check

mypyc/transform/exceptions.py:177–192  ·  view source on GitHub ↗

Append to ops to check for an overlapping error value.

(ops: list[Op], target: Value)

Source from the content-addressed store, hash-verified

175
176
177def insert_overlapping_error_value_check(ops: list[Op], target: Value) -> ComparisonOp:
178 """Append to ops to check for an overlapping error value."""
179 typ = target.type
180 if isinstance(typ, RTuple):
181 item = TupleGet(target, 0)
182 ops.append(item)
183 return insert_overlapping_error_value_check(ops, item)
184 else:
185 errvalue: Value
186 if is_float_rprimitive(target.type):
187 errvalue = Float(float(typ.c_undefined))
188 else:
189 errvalue = Integer(int(typ.c_undefined), rtype=typ)
190 op = ComparisonOp(target, errvalue, ComparisonOp.EQ)
191 ops.append(op)
192 return op

Callers 1

split_blocks_at_errorsFunction · 0.85

Calls 9

TupleGetClass · 0.90
is_float_rprimitiveFunction · 0.90
FloatClass · 0.90
IntegerClass · 0.90
ComparisonOpClass · 0.90
isinstanceFunction · 0.85
floatClass · 0.85
intClass · 0.85
appendMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…