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
Handle misaligned arrays in `as_slice`
Previously, `as_slice` would only check that arrays are contiguous.
While misaligned non-empty arrays remain problematic across the library
(`get`, for example, would still be invalid), this change begins
handling this situation in a function that already returns `Result`.
As a convenience, the empty slice is returned for zero-length arrays,
regardless of the alignment of the underlying pointer. Misaligned
zero-length pointers can fairly easily arise from allocator
optimisations. For example, CPython reliably returned an odd-address
pointer in `bytearray()` in (at least) CPython 3.14.0 on Linux x86-64,
which caused empty Numpy arrays passing through Pickle protocol 5 (with
the default handling of its `PickleBuffer`s) to be backed by a
misaligned pointer for multi-byte aligned dtypes.
0 commit comments