From e4fdd30787822bd0aa1eec3ebf0539c55b7cfa3c Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Thu, 21 Mar 2024 20:22:34 +0000 Subject: [PATCH] avoid reference count cycle in tuple extraction --- src/types/tuple.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/types/tuple.rs b/src/types/tuple.rs index d8053e1441a..d89830daa97 100644 --- a/src/types/tuple.rs +++ b/src/types/tuple.rs @@ -690,10 +690,10 @@ fn type_output() -> TypeInfo { let t = obj.downcast::()?; 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)) }