From f3b088642cc208c1acd0cce6e71bbd8422f66a09 Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Tue, 9 Jul 2024 12:33:53 +0100 Subject: [PATCH] undo unintended revert --- src/instance.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/instance.rs b/src/instance.rs index ea4b7bc9400..c4600204d9d 100644 --- a/src/instance.rs +++ b/src/instance.rs @@ -1330,7 +1330,10 @@ impl Py { /// ``` #[inline] pub fn clone_ref(&self, py: Python<'_>) -> Py { - unsafe { Py::from_borrowed_ptr(py, self.0.as_ptr()) } + unsafe { + ffi::Py_INCREF(self.as_ptr()); + Self::from_non_null(self.0) + } } /// Drops `self` and immediately decreases its reference count.