Skip to content

TypedPython: zero-copy buffer-protocol arrays (array.array, numpy, memoryview) as ArrayParam #149

Open

Description

@b-re-w

Approved by the user (2026-10-04). Lists are copied in and written back (O(n) per call); numba and Cython read buffers in place. Accept exact array.array / numpy ndarray (contiguous, matching dtype) / memoryview parameters as native arrays without copy. Identity holds because no user code runs while the array is live (the existing ArrayParam contract), so direct writes are observed exactly when CPython would make them visible.

Done when: differential tests against the interpreter for each buffer type, non-contiguous and wrong-dtype buffers take the object path, a released/resized buffer cannot be used (PyBUF lifetime), and a call-heavy benchmark shows the copy gone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions