Skip to content

Commit

Permalink
simplify implementation of Py::clone_ref (#4313)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Jul 7, 2024
1 parent 59c4fa3 commit d5c886f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1329,8 +1329,11 @@ impl<T> Py<T> {
/// # }
/// ```
#[inline]
pub fn clone_ref(&self, py: Python<'_>) -> Py<T> {
unsafe { Py::from_borrowed_ptr(py, self.0.as_ptr()) }
pub fn clone_ref(&self, _py: Python<'_>) -> Py<T> {
unsafe {
ffi::Py_INCREF(self.as_ptr());
Self::from_non_null(self.0)
}
}

/// Drops `self` and immediately decreases its reference count.
Expand Down

0 comments on commit d5c886f

Please sign in to comment.