Skip to content

Commit a213ab5

Browse files
committed
Arrays don't need to support buffer protocol
1 parent 40de1c9 commit a213ab5

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

array_api_compat/cupy/_aliases.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@
6666

6767
# asarray also adds the copy keyword, which is not present in numpy 1.0.
6868
def asarray(
69-
obj: bool | complex | NestedSequence[bool | complex] | SupportsBufferProtocol,
69+
obj: Array | bool | complex | NestedSequence[bool | complex]
70+
| SupportsBufferProtocol,
7071
/,
7172
*,
7273
dtype: Optional[DType] = None,

array_api_compat/dask/array/_aliases.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ def arange(
135135

136136
# asarray also adds the copy keyword, which is not present in numpy 1.0.
137137
def asarray(
138-
obj: bool | complex | NestedSequence[bool | complex] | SupportsBufferProtocol,
138+
obj: Array | bool | complex | NestedSequence[bool | complex]
139+
| SupportsBufferProtocol,
139140
/,
140141
*,
141142
dtype: Optional[DType] = None,

array_api_compat/numpy/_aliases.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def _supports_buffer_protocol(obj):
7373
# complicated enough that it's easier to define it separately for each module
7474
# rather than trying to combine everything into one function in common/
7575
def asarray(
76-
obj: bool | complex | NestedSequence[bool | complex] | SupportsBufferProtocol,
76+
obj: Array | bool | complex | NestedSequence[bool | complex]
77+
| SupportsBufferProtocol,
7778
/,
7879
*,
7980
dtype: Optional[DType] = None,

0 commit comments

Comments
 (0)