Skip to content

Commit 991ffa7

Browse files
committed
Use a less grandiose name of the borrow checking API capsule to avoid misunderstands on its scope.
1 parent b12c07b commit 991ffa7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/borrow/shared.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::error::BorrowError;
1515
/// Defines the shared C API used for borrow checking
1616
///
1717
/// This structure will be placed into a capsule at
18-
/// `numpy.core.multiarray._BORROW_CHECKING_API`.
18+
/// `numpy.core.multiarray._RUST_NUMPY_BORROW_CHECKING_API`.
1919
///
2020
/// All functions exposed here assume the GIL is held
2121
/// while they are called.
@@ -175,14 +175,14 @@ fn get_or_insert_shared<'py>(py: Python<'py>) -> PyResult<&'py Shared> {
175175
}
176176

177177
// This function will publish this extensions version of the shared borrow checking API
178-
// as a capsule placed at `numpy.core.multiarray._BORROW_CHECKING_API` and
178+
// as a capsule placed at `numpy.core.multiarray._RUST_NUMPY_BORROW_CHECKING_API` and
179179
// immediately initialize the cache used access it from this extension.
180180

181181
#[cold]
182182
fn insert_shared(py: Python) -> PyResult<*const Shared> {
183183
let module = get_array_module(py)?;
184184

185-
let capsule: &PyCapsule = match module.getattr("_BORROW_CHECKING_API") {
185+
let capsule: &PyCapsule = match module.getattr("_RUST_NUMPY_BORROW_CHECKING_API") {
186186
Ok(capsule) => capsule.try_into()?,
187187
Err(_err) => {
188188
let flags = Box::into_raw(Box::new(BorrowFlags::default()));
@@ -199,13 +199,13 @@ fn insert_shared(py: Python) -> PyResult<*const Shared> {
199199
let capsule = PyCapsule::new_with_destructor(
200200
py,
201201
shared,
202-
Some(CString::new("_BORROW_CHECKING_API").unwrap()),
202+
Some(CString::new("_RUST_NUMPY_BORROW_CHECKING_API").unwrap()),
203203
|shared, _ctx| {
204204
// SAFETY: `shared.flags` was initialized using `Box::into_raw`.
205205
let _ = unsafe { Box::from_raw(shared.flags as *mut BorrowFlags) };
206206
},
207207
)?;
208-
module.setattr("_BORROW_CHECKING_API", capsule)?;
208+
module.setattr("_RUST_NUMPY_BORROW_CHECKING_API", capsule)?;
209209
capsule
210210
}
211211
};

0 commit comments

Comments
 (0)