Skip to content

Commit b570a84

Browse files
committed
Fix backwards compat
1 parent 9b1d449 commit b570a84

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

array_api_compat/dask/array/_aliases.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,13 @@ def asarray(
146146
):
147147
return obj.copy()
148148

149-
return da.asarray(obj, dtype=dtype)
149+
obj = da.asarray(obj, dtype=dtype)
150+
151+
# Backport https://github.com/dask/dask/pull/11586
152+
if dtype not in (None, obj.dtype):
153+
obj = obj.astype(dtype)
154+
155+
return obj
150156

151157

152158
from dask.array import (

0 commit comments

Comments
 (0)