diff --git a/src/anndata/_core/merge.py b/src/anndata/_core/merge.py index 276db242f..1414bff98 100644 --- a/src/anndata/_core/merge.py +++ b/src/anndata/_core/merge.py @@ -189,6 +189,15 @@ def equal_sparse(a, b) -> bool: # Comparison broken for CSC matrices # https://github.com/cupy/cupy/issues/7757 a, b = CupyCSRMatrix(a), CupyCSRMatrix(b) + if Version(scipy.__version__) >= Version("1.16.0rc1"): + # TODO: https://github.com/scipy/scipy/issues/23068 + return bool( + a.format == b.format + and (a.shape == b.shape) + and np.all(a.indptr == b.indptr) + and np.all(a.indices == b.indices) + and np.all((a.data == b.data) | (np.isnan(a.data) & np.isnan(b.data))) + ) comp = a != b if isinstance(comp, bool): return not comp