(py: Python<'py>)
| 106 | static SHARED: SharedPtr = SharedPtr(PyOnceLock::new()); |
| 107 | |
| 108 | fn get_or_insert_shared<'py>(py: Python<'py>) -> PyResult<&'py Shared> { |
| 109 | let shared = SHARED.0.get_or_try_init(py, || insert_shared(py))?; |
| 110 | |
| 111 | // SAFETY: We inserted the capsule if it was missing |
| 112 | // and verified that it contains a compatible version. |
| 113 | Ok(unsafe { shared.as_ref() }) |
| 114 | } |
| 115 | |
| 116 | // This function will publish this extension's version of the shared borrow checking API |
| 117 | // as a capsule placed at `numpy.core.multiarray._RUST_NUMPY_BORROW_CHECKING_API` and |
no test coverage detected