rust/pyo3-sharedref/tests/test_sharedref.rs
changeset 52612 a945845137b1
parent 52611 4a73eb3923ac
child 52613 ac0cb3c334a1
--- a/rust/pyo3-sharedref/tests/test_sharedref.rs	Sun Dec 15 15:19:43 2024 +0100
+++ b/rust/pyo3-sharedref/tests/test_sharedref.rs	Sun Dec 15 15:36:11 2024 +0100
@@ -28,16 +28,14 @@
 /// taking care of all the boilerplate
 fn leak_string(owner: &Bound<'_, Owner>) -> SharedByPyObject<&'static String> {
     let cell = &owner.borrow().string;
-    let shared_ref = unsafe { cell.borrow_with_owner(owner) };
-    shared_ref.share_immutable()
+    unsafe { cell.share(owner) }
 }
 
 fn try_leak_string(
     owner: &Bound<'_, Owner>,
 ) -> Result<SharedByPyObject<&'static String>, TryShareError> {
     let cell = &owner.borrow().string;
-    let shared_ref = unsafe { cell.borrow_with_owner(owner) };
-    shared_ref.try_share_immutable()
+    unsafe { cell.try_share(owner) }
 }
 
 /// Mutate the `string` field of `owner` as would be done from Python code