Skip to content

Commit 7fe9d7f

Browse files
committed
TYP: Use collections.abc.Buffer in the Array API
Original NumPy Commit: 5bc9c3ab05d42d3d5904223e52c8d892eac8f32b
1 parent a08a997 commit 7fe9d7f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

array_api_strict/_typing.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
"PyCapsule",
1818
]
1919

20+
import sys
21+
2022
from typing import (
2123
Any,
2224
Literal,
@@ -63,8 +65,11 @@ def __len__(self, /) -> int: ...
6365
float64,
6466
]]
6567

68+
if sys.version_info >= (3, 12):
69+
from collections.abc import Buffer as SupportsBufferProtocol
70+
else:
71+
SupportsBufferProtocol = Any
6672

67-
SupportsBufferProtocol = Any
6873
PyCapsule = Any
6974

7075
class SupportsDLPack(Protocol):

0 commit comments

Comments
 (0)