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:
1 parent
a29405455a
commit
cb0f9956c3
8 files changed
+907
-458
No files matched your search
+1
-2
@@ -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: ...
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user