Skip to content

Commit 8f86278

Browse files
committed
_serialize_ndarray_container: raise TypeError for non-object-arrays
1 parent c106155 commit 8f86278

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

arraycontext/container/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def get_container_context(ary: ArrayContainer) -> Optional[ArrayContext]:
202202
@serialize_container.register(np.ndarray)
203203
def _serialize_ndarray_container(ary: np.ndarray) -> Iterable[Tuple[Any, Any]]:
204204
if ary.dtype.char != "O":
205-
raise ValueError(
205+
raise TypeError(
206206
f"cannot seriealize '{type(ary).__name__}' with dtype '{ary.dtype}'")
207207

208208
# special-cased for speed

test/test_arraycontext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ def test_numpy_conversion(actx_factory):
904904
with pytest.raises(TypeError):
905905
from_numpy(ac_actx, actx)
906906

907-
with pytest.raises(ValueError):
907+
with pytest.raises(TypeError):
908908
to_numpy(ac, actx)
909909

910910
# }}}

0 commit comments

Comments
 (0)