Use static ref

This commit is contained in:
Jeong Yunwon
2022-05-30 06:54:56 +09:00
parent ea95777ec7
commit 09fc676164
6 changed files with 95 additions and 77 deletions

View File

@@ -82,7 +82,7 @@ impl Deref for ArgIntoFloat {
impl TryFromObject for ArgIntoFloat {
// Equivalent to PyFloat_AsDouble.
fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self> {
let value = PyNumber::from(obj.as_ref()).float(vm)?.to_f64();
let value = PyNumber::new(obj.as_ref(), vm).float(vm)?.to_f64();
Ok(ArgIntoFloat { value })
}
}