BlockLayout2D.to_dense: restore hole-only NaN fill guard

cc64abc dropped the guard, so full layouts with integer arrays raised on
an empty NaN assignment (regression caught by test_to_dense_dtype_contract).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-10-16 03:20:56 +00:00
co-authored by Claude Opus 5.5
parent cc64abcafe
commit 68ecaf9e81
+2 -1
View File
@@ -330,7 +330,8 @@ class BlockLayout2D:
raise ValueError("a layout with holes unpacks floating arrays only (holes are NaN)")
ob, oc = np.divmod(self.owner.ravel()[owned].astype(np.intp), flat.shape[2])
dense = np.empty((NQ, owned.size), dtype=blocked.dtype)
dense[:, ~owned] = np.nan
if not owned.all(): # even an empty NaN assignment fails for integer dtypes
dense[:, ~owned] = np.nan
dense[:, owned] = flat[ob, :, oc].T
return dense.reshape(NQ, *self.shape)