pub fn is_valid_slice_arg(
    arg: OptionalArg<PyObjectRef>,
    vm: &VirtualMachine,
) -> PyResult<Option<BigInt>> {
    if let OptionalArg::Present(value) = arg {
        match_class!(match value {
            i @ PyInt => Ok(Some(i.as_bigint().clone())),
            _obj @ PyNone => Ok(None),
            _ => Err(vm.new_type_error(
                "slice indices must be integers or None or have an __index__ method".to_owned()
            )), // TODO: check for an __index__ method
        })
    } else {
        Ok(None)
    }
}
//Check if given arg could be used with PySliceableSequence.get_slice_range()
Check if given arg could be used with PySliceableSequence.get_slice_range()
Check if given arg could be used with PySliceableSequence . get_slice_range ()
pub fn is_valid_slice_arg(
    arg: OptionalArg<PyObjectRef>,
    vm: &VirtualMachine,
) -> PyResult<Option<BigInt>> {
    if let OptionalArg::Present(value) = arg {
        match_class!(match value {
            i @ PyInt => Ok(Some(i.as_bigint().clone())),
            _obj @ PyNone => Ok(None),
            _ => Err(vm.new_type_error(
                "slice indices must be integers or None or have an __index__ method".to_owned()
            )), // TODO: check for an __index__ method
        })
    } else {
        Ok(None)
    }
}
pub fn is_valid_slice_arg ( arg : OptionalArg < PyObjectRef > , vm : & VirtualMachine , ) -> PyResult < Option < BigInt > > { if let OptionalArg :: Present ( value ) = arg { match_class ! ( match value { i PyInt Ok ( Some ( i as_bigint ( ) clone ( ) ) ) _obj PyNone Ok ( None ) Err ( vm new_type_error ( " " to_owned ( ) ) ) // TODO: check for an __index__ method } ) } else { Ok ( None ) } }
Check if given arg could be used with PySliceableSequence.get_slice_range()
Check if given arg could be used with PySliceableSequence . get_slice_range ()
arg
OptionalArg<PyObjectRef>
vm
&VirtualMachine
arg
OptionalArg<PyObjectRef>
vm
&VirtualMachine