(&self, vm: &VirtualMachine)
| 90 | } |
| 91 | |
| 92 | pub fn try_float_opt(&self, vm: &VirtualMachine) -> Option<PyResult<PyRef<PyFloat>>> { |
| 93 | if let Some(float) = self.downcast_ref_if_exact::<PyFloat>(vm) { |
| 94 | Some(Ok(float.to_owned())) |
| 95 | } else if let Some(f) = self.number().float(vm) { |
| 96 | Some(f) |
| 97 | } else { |
| 98 | self.try_index_opt(vm) |
| 99 | .map(|i| Ok(vm.ctx.new_float(int::try_to_float(i?.as_bigint(), vm)?))) |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | #[inline] |
| 104 | pub fn try_float(&self, vm: &VirtualMachine) -> PyResult<PyRef<PyFloat>> { |
no test coverage detected