Skip to content

Commit

Permalink
array: fix sequence lengths in error message
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt authored Apr 27, 2021
1 parent 068e311 commit a084cd5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/conversions/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ where
T: FromPyObject<'s>,
{
let seq = <crate::types::PySequence as PyTryFrom>::try_from(obj)?;
let expected_len = seq.len()? as usize;
if expected_len != slice.len() {
return Err(invalid_sequence_length(expected_len, slice.len()));
let seq_len = seq.len()? as usize;
if seq_len != slice.len() {
return Err(invalid_sequence_length(slice.len(), seq_len));
}
for (value, item) in slice.iter_mut().zip(seq.iter()?) {
*value = item?.extract::<T>()?;
Expand Down

0 comments on commit a084cd5

Please sign in to comment.