Skip to content

Commit

Permalink
fix case of checking truthiness of NotImplemented (#1298)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt authored May 22, 2024
1 parent 2415f42 commit 88a8a30
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/serializers/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ fn map_negative_index<'py>(value: &Bound<'py, PyAny>, len: Option<usize>) -> 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 {
if value.lt(0).unwrap_or(false) {
Err(PyValueError::new_err(
"Negative indices cannot be used to exclude items on unsized iterables",
))
Expand Down

0 comments on commit 88a8a30

Please sign in to comment.