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

Method read_nullable_attr

mypyc/irbuild/builder.py:819–822  ·  view source on GitHub ↗

Read an attribute that might have an error value without raising AttributeError.

(self, obj: Value, attr: str, line: int = -1)

Source from the content-addressed store, hash-verified

817 assert False, "Unsupported lvalue: %r" % target
818
819 def read_nullable_attr(self, obj: Value, attr: str, line: int = -1) -> Value:
820 """Read an attribute that might have an error value without raising AttributeError."""
821 assert isinstance(obj.type, RInstance) and obj.type.class_ir.is_ext_class
822 return self.add(GetAttr(obj, attr, line, allow_error_value=True))
823
824 def assign(self, target: Register | AssignmentTarget, rvalue_reg: Value, line: int) -> None:
825 if isinstance(target, Register):

Callers 1

Calls 3

addMethod · 0.95
GetAttrClass · 0.90
isinstanceFunction · 0.85

Tested by

no test coverage detected