Skip to content

Commit 2e9cfca

Browse files
authored
(fix): scipy 1.16 fix (#1999)
1 parent a5628b6 commit 2e9cfca

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/anndata/_core/merge.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,15 @@ def equal_sparse(a, b) -> bool:
189189
# Comparison broken for CSC matrices
190190
# https://github.com/cupy/cupy/issues/7757
191191
a, b = CupyCSRMatrix(a), CupyCSRMatrix(b)
192+
if Version(scipy.__version__) >= Version("1.16.0rc1"):
193+
# TODO: https://github.com/scipy/scipy/issues/23068
194+
return bool(
195+
a.format == b.format
196+
and (a.shape == b.shape)
197+
and np.all(a.indptr == b.indptr)
198+
and np.all(a.indices == b.indices)
199+
and np.all((a.data == b.data) | (np.isnan(a.data) & np.isnan(b.data)))
200+
)
192201
comp = a != b
193202
if isinstance(comp, bool):
194203
return not comp

0 commit comments

Comments
 (0)