Skip to content

Commit

Permalink
avoid reference count cycle in tuple extraction (#3976)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt authored Mar 22, 2024
1 parent 990886e commit 20e477a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/types/tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -690,10 +690,10 @@ fn type_output() -> TypeInfo {
let t = obj.downcast::<PyTuple>()?;
if t.len() == $length {
#[cfg(any(Py_LIMITED_API, PyPy))]
return Ok(($(t.get_item($n)?.extract::<$T>()?,)+));
return Ok(($(t.get_borrowed_item($n)?.extract::<$T>()?,)+));

#[cfg(not(any(Py_LIMITED_API, PyPy)))]
unsafe {return Ok(($(t.get_item_unchecked($n).extract::<$T>()?,)+));}
unsafe {return Ok(($(t.get_borrowed_item_unchecked($n).extract::<$T>()?,)+));}
} else {
Err(wrong_tuple_length(t, $length))
}
Expand Down

0 comments on commit 20e477a

Please sign in to comment.