Skip to content

Commit 1b13d77

Browse files
enforce self.dtype as a numpy type
* addresses the nbytes problem described in pydata#9185
1 parent 42ed6d3 commit 1b13d77

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

xarray/namedarray/core.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,8 @@ def nbytes(self) -> _IntOrUnknown:
475475
if hasattr(self._data, "nbytes"):
476476
return self._data.nbytes # type: ignore[no-any-return]
477477

478-
if hasattr(self.dtype, "itemsize"):
479-
itemsize = self.dtype.itemsize
478+
if hasattr(np.dtype(self.dtype), "itemsize"):
479+
itemsize = np.dtype(self.dtype).itemsize
480480
elif isinstance(self._data, _arrayapi):
481481
xp = _get_data_namespace(self)
482482

0 commit comments

Comments
 (0)