Skip to content

Commit

Permalink
simplify implementation of Py::clone_ref
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Jul 5, 2024
1 parent 9afc38a commit 8e2167c
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 8e2167c

Please sign in to comment.