(_cls: &Py<PyType>, arg: Self::Args, vm: &VirtualMachine)
| 186 | } |
| 187 | |
| 188 | fn py_new(_cls: &Py<PyType>, arg: Self::Args, vm: &VirtualMachine) -> PyResult<Self> { |
| 189 | let float_val = match arg { |
| 190 | OptionalArg::Missing => 0.0, |
| 191 | OptionalArg::Present(val) => { |
| 192 | if let Some(f) = val.try_float_opt(vm) { |
| 193 | f?.value |
| 194 | } else { |
| 195 | float_from_string(val, vm)? |
| 196 | } |
| 197 | } |
| 198 | }; |
| 199 | Ok(Self::from(float_val)) |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | fn float_from_string(val: PyObjectRef, vm: &VirtualMachine) -> PyResult<f64> { |
nothing calls this directly
no test coverage detected