You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Perform borrow checking through a capsule-based API
This places the global state required for dynamic borrow checking of NumPy
arrays into a capsule exposed as the numpy.core.multiarray._BORROW_CHECKING_API
attribute.
This has two benefits: First, all extensions built using rust-numpy will share
this global state and hence cooperate in borrow checking. Second, in the future,
other libraries that want to borrow check their access to NumPy array can
cooperate using this C-compatible API.
This does not checking the borrow checking implementation at all, but instead of
accessing Rust static data, all accesses are funneled through the
above-mentioned capsule API with access to it being cached for performance reasons
as we already do for the _ARRAY_API and _UFUNC_API capsules.
This means that eventually, the implementation of the borrow checking API could
be different from the one the current extension would provide with the adaptors
to the C API taking of any differences in e.g. the definition of `BorrowKey`.
For now, they will of course usually be the same and this change just adds a
huge amount of boiler plate to go from Rust to C-compatible back to Rust.
0 commit comments