API cleanup for simplified update/final. Returns bytearrays when into is not used. Allows into buffers larger than needed. Misc other changes.

This commit is contained in:
Leo Vasanko
2025-11-06 19:38:18 -06:00
parent 46dff56e28
commit 7175654b27
10 changed files with 1277 additions and 1254 deletions
+14 -1
View File
@@ -6,9 +6,22 @@ on libc/posix_memalign. Memory is owned by Python; C code only borrows it.
from __future__ import annotations
from typing import Protocol
from ._loader import ffi
__all__ = ["new_aligned_struct", "aligned_address"]
__all__ = ["new_aligned_struct", "aligned_address", "Buffer"]
try:
from collections.abc import Buffer as _Buffer
class Buffer(_Buffer, Protocol): # type: ignore[misc]
def __len__(self) -> int: ...
except ImportError:
class Buffer(Protocol):
def __len__(self) -> int: ...
def __buffer__(self, flags: int) -> memoryview: ...
def aligned_address(obj) -> int: