diff --git a/vm/src/function/number.rs b/vm/src/function/number.rs index 5fa1e247e..b316aa5b8 100644 --- a/vm/src/function/number.rs +++ b/vm/src/function/number.rs @@ -1,5 +1,4 @@ -use crate::{AsObject, PyObjectRef, PyResult, TryFromObject, VirtualMachine}; -use num_bigint::BigInt; +use crate::{builtins::PyIntRef, AsObject, PyObjectRef, PyResult, TryFromObject, VirtualMachine}; use num_complex::Complex64; use std::ops::Deref; @@ -128,20 +127,20 @@ impl TryFromObject for ArgIntoBool { } // Implement ArgIndex to seperate between "true" int and int generated by index -#[derive(Debug, PartialEq)] +#[derive(Debug)] #[repr(transparent)] pub struct ArgIndex { - value: BigInt, + value: PyIntRef, } -impl From for BigInt { +impl From for PyIntRef { fn from(arg: ArgIndex) -> Self { arg.value } } impl Deref for ArgIndex { - type Target = BigInt; + type Target = PyIntRef; fn deref(&self) -> &Self::Target { &self.value @@ -151,7 +150,7 @@ impl Deref for ArgIndex { impl TryFromObject for ArgIndex { fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult { Ok(Self { - value: obj.try_index(vm)?.as_bigint().clone(), + value: obj.try_index(vm)?, }) } }