(py: Python<'py>, array: *mut PyArrayObject)
| 186 | } |
| 187 | |
| 188 | pub fn acquire_mut<'py>(py: Python<'py>, array: *mut PyArrayObject) -> Result<(), BorrowError> { |
| 189 | let shared = get_or_insert_shared(py).expect("Internal borrow checking API error"); |
| 190 | |
| 191 | let rc = unsafe { (shared.acquire_mut)(shared.flags, array) }; |
| 192 | |
| 193 | match rc { |
| 194 | 0 => Ok(()), |
| 195 | -1 => Err(BorrowError::AlreadyBorrowed), |
| 196 | -2 => Err(BorrowError::NotWriteable), |
| 197 | rc => panic!("Unexpected return code {rc} from borrow checking API"), |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | pub fn release<'py>(py: Python<'py>, array: *mut PyArrayObject) { |
| 202 | let shared = get_or_insert_shared(py).expect("Internal borrow checking API error"); |
no test coverage detected