From 645692859cae31d9f71fe5f10f9bcb3a0f7a5760 Mon Sep 17 00:00:00 2001 From: person93 Date: Fri, 22 May 2026 13:43:23 -0400 Subject: [PATCH 1/2] update safety docs for `PyCapsule::import` --- src/types/capsule.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/types/capsule.rs b/src/types/capsule.rs index 12d2232c56c..5637f8b4919 100644 --- a/src/types/capsule.rs +++ b/src/types/capsule.rs @@ -385,7 +385,9 @@ impl PyCapsule { /// /// # Safety /// - /// It must be known that the capsule imported by `name` contains an item of type `T`. + /// - It must be known that the capsule imported by `name` contains an item of type `T`. + /// - The contents of the capsule must not be mutated by any third-party code while the reference is alive. + /// The python interpreter does _NOT_ provide any synchronization guarantees for capsules. pub unsafe fn import<'py, T>(py: Python<'py>, name: &CStr) -> PyResult<&'py T> { // SAFETY: `name` is a valid C string, thread is attached to the Python interpreter let ptr = unsafe { ffi::PyCapsule_Import(name.as_ptr(), false as c_int) }; From 564beb8ecc49bb215c8ec0ce23fb839ee5778df6 Mon Sep 17 00:00:00 2001 From: person93 Date: Fri, 22 May 2026 14:26:04 -0400 Subject: [PATCH 2/2] empty commit to trigger ci