Function
handle_bytes_to_int_err
(
e: BytesToIntError,
obj: &PyObject,
vm: &VirtualMachine,
)
Source from the content-addressed store, hash-verified
| 731 | } |
| 732 | |
| 733 | pub fn handle_bytes_to_int_err( |
| 734 | e: BytesToIntError, |
| 735 | obj: &PyObject, |
| 736 | vm: &VirtualMachine, |
| 737 | ) -> PyBaseExceptionRef { |
| 738 | match e { |
| 739 | BytesToIntError::InvalidLiteral { base } => vm.new_value_error(format!( |
| 740 | "invalid literal for int() with base {base}: {}", |
| 741 | match obj.repr(vm) { |
| 742 | Ok(v) => v, |
| 743 | Err(err) => return err, |
| 744 | }, |
| 745 | )), |
| 746 | BytesToIntError::InvalidBase => { |
| 747 | vm.new_value_error("int() base must be >= 2 and <= 36, or 0") |
| 748 | } |
| 749 | BytesToIntError::DigitLimit { got, limit } => vm.new_value_error(format!( |
| 750 | "Exceeds the limit ({limit} digits) for integer string conversion: value has {got} digits; use sys.set_int_max_str_digits() to increase the limit" |
| 751 | )), |
| 752 | } |
| 753 | } |
Tested by
no test coverage detected