It should be possible to easily make memoryview objects from pointer-able ctypes objects with an arbitrary length. In the same way we can currently use ctypes.string_at() to create bytes objects. The advantage of using memoryview objects is that we can elide a buffer copy.
Activity
rianhunter commented on Sep 19, 2024
Abandoned
ncoghlan commented on Sep 26, 2024
@encukou is taking up work on the associated PR. Thanks for taking it this far @rianhunter!
gh-112015: Implement `ctypes.memoryview_at()` (GH-112018)
encukou commented on Jan 3, 2025
And it's in!
Thank you @rianhunter for the proposal and implementation, and all the reviewers for their insights.
pythongh-112015: Implement `ctypes.memoryview_at()` (pythonGH-112018)
pythongh-112015: Implement `ctypes.memoryview_at()` (pythonGH-112018)