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

Function adjust_error_kinds

mypyc/transform/exceptions.py:162–174  ·  view source on GitHub ↗

Infer more precise error_kind attributes for ops. We have access here to more information than what was available when the IR was initially built.

(block: BasicBlock)

Source from the content-addressed store, hash-verified

160
161
162def adjust_error_kinds(block: BasicBlock) -> None:
163 """Infer more precise error_kind attributes for ops.
164
165 We have access here to more information than what was available
166 when the IR was initially built.
167 """
168 for op in block.ops:
169 if isinstance(op, GetAttr):
170 if op.class_type.class_ir.is_always_defined(op.attr):
171 op.error_kind = ERR_NEVER
172 if isinstance(op, SetAttr):
173 if op.class_type.class_ir.is_always_defined(op.attr):
174 op.error_kind = ERR_NEVER
175
176
177def insert_overlapping_error_value_check(ops: list[Op], target: Value) -> ComparisonOp:

Callers 1

Calls 2

isinstanceFunction · 0.85
is_always_definedMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…