Skip to content

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

Closed

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.

Activity

  1. added a commit that references this issue on Oct 25, 2026
  2. b-re-w commented on Oct 25, 2026

    @b-re-w
    MemberAuthor

    Landed in develop via #299 (memoryview params, BufferError tests, SPEC on concurrent writes, buffer_calls.py benchmark file; measurement deferred to the quiet batch). array.array and numpy were already covered by step 1 and #220.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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