Convert all input buffers to memoryview before use and use .nbytes, because len() doesn't work correctly with some buffers. Update docs with a Numpy example.

This commit is contained in:
Leo Vasanko
2025-11-09 09:46:21 -06:00
parent 20e0ed8c5f
commit bb9d11842a
8 changed files with 907 additions and 458 deletions
+1 -2
View File
@@ -14,11 +14,10 @@ try:
from collections.abc import Buffer as _Buffer # type: ignore[misc]
class Buffer(_Buffer, Protocol): # type: ignore[misc]
def __len__(self) -> int: ...
pass
except ImportError:
class Buffer(Protocol):
def __len__(self) -> int: ...
def __buffer__(self, flags: int) -> memoryview: ...