Skip to content

Commit a8a8930

Browse files
authored
Merge pull request #24705 from BvB93/buffer
TYP: Add annotations for the py3.12 buffer protocol Original NumPy Commit: f6bf183abbb61507647aaf40b48c28525fc18e48
2 parents a08a997 + 7fe9d7f commit a8a8930

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)