From f0210bd944dde68f0f37db6e0ecb37c20ca52af2 Mon Sep 17 00:00:00 2001 From: ilan-gold Date: Wed, 28 May 2025 14:34:05 +0200 Subject: [PATCH] (fix): scipy 1.16 fix --- src/anndata/_core/merge.py | 9 +++++++++ 1 file changed, 9 insertions(+) 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