(flags: *mut c_void, array: *mut PyArrayObject)
| 43 | // These are the entry points which implement the shared borrow checking API: |
| 44 | |
| 45 | unsafe extern "C" fn acquire_shared(flags: *mut c_void, array: *mut PyArrayObject) -> c_int { |
| 46 | // SAFETY: must be attached when calling `acquire_shared`. |
| 47 | let py = Python::assume_attached(); |
| 48 | let flags = &*(flags as *mut BorrowFlags); |
| 49 | |
| 50 | let address = base_address(py, array); |
| 51 | let key = borrow_key(py, array); |
| 52 | |
| 53 | match flags.acquire(address, key) { |
| 54 | Ok(()) => 0, |
| 55 | Err(()) => -1, |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | unsafe extern "C" fn acquire_mut_shared(flags: *mut c_void, array: *mut PyArrayObject) -> c_int { |
| 60 | if (*array).flags & NPY_ARRAY_WRITEABLE == 0 { |
nothing calls this directly
no test coverage detected