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

Method emit_fixed_width_overflow_error

mypyc/irbuild/ll_builder.py:658–668  ·  view source on GitHub ↗

Emit overflow error for fixed-width type conversion.

(self, target_type: RType, line: int)

Source from the content-addressed store, hash-verified

656 return res
657
658 def emit_fixed_width_overflow_error(self, target_type: RType, line: int) -> None:
659 """Emit overflow error for fixed-width type conversion."""
660 if is_int32_rprimitive(target_type):
661 self.call_c(int32_overflow, [], line)
662 elif is_int16_rprimitive(target_type):
663 self.call_c(int16_overflow, [], line)
664 elif is_uint8_rprimitive(target_type):
665 self.call_c(uint8_overflow, [], line)
666 else:
667 assert False, target_type
668 self.add(Unreachable())
669
670 def coerce_short_int_to_fixed_width(self, src: Value, target_type: RType, line: int) -> Value:
671 # short_int (CPyTagged) is guaranteed to be a tagged value, never a pointer,

Calls 6

call_cMethod · 0.95
addMethod · 0.95
is_int32_rprimitiveFunction · 0.90
is_int16_rprimitiveFunction · 0.90
is_uint8_rprimitiveFunction · 0.90
UnreachableClass · 0.90

Tested by

no test coverage detected