diff --git a/src/serializers/filter.rs b/src/serializers/filter.rs index 8ba4a3bc2..487f7d1de 100644 --- a/src/serializers/filter.rs +++ b/src/serializers/filter.rs @@ -23,8 +23,8 @@ fn map_negative_index<'py>(value: &Bound<'py, PyAny>, len: Option) -> PyR .unwrap_or_else(|_| value.clone())), None => { // check that it's not negative - let negative = value.call_method1(intern!(py, "__lt__"), (0,))?.is_truthy()?; - if negative { + let negative = value.lt(0); + if matches!(negative, Ok(true)) { Err(PyValueError::new_err( "Negative indices cannot be used to exclude items on unsized iterables", ))