Skip to content

Commit 6e30532

Browse files
kaushikcfdinducer
authored andcommitted
ArrayContainer fixes for numpy arrays as leaf classes
1 parent c32e4e1 commit 6e30532

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

arraycontext/container/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,11 @@ def is_array_container(ary: Any) -> bool:
216216
"cheaper option, see is_array_container_type.",
217217
DeprecationWarning, stacklevel=2)
218218
return (serialize_container.dispatch(ary.__class__)
219-
is not serialize_container.__wrapped__) # type:ignore[attr-defined]
219+
is not serialize_container.__wrapped__ # type:ignore[attr-defined]
220+
# numpy values with scalar elements aren't array containers
221+
and not (isinstance(ary, np.ndarray)
222+
and ary.dtype.kind != "O")
223+
)
220224

221225

222226
@singledispatch

0 commit comments

Comments
 (0)