File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -429,6 +429,15 @@ class Int32(ZDType[np.dtypes.Int32DType, np.int32]):
429429 _zarr_v2_names : ClassVar [tuple [str , ...]] = (">i4" , "<i4" )
430430 endianness : Endianness | None = "little"
431431
432+ @classmethod
433+ def from_dtype (cls : type [Self ], dtype : _BaseDType ) -> Self :
434+ # We override the base implementation to address a windows-specific, pre-numpy 2 issue where
435+ # ``np.dtype('i')`` is an instance of ``np.dtypes.IntDType`` that acts like `int32` instead of ``np.dtype('int32')``
436+ if dtype == np .dtypes .Int32DType ():
437+ return cls ._from_dtype_unsafe (np .dtypes .Int32DType ().newbyteorder (dtype .byteorder ))
438+ else :
439+ return super ().from_dtype (dtype )
440+
432441 @classmethod
433442 def _from_dtype_unsafe (cls , dtype : np .dtypes .Int32DType ) -> Self :
434443 byte_order = cast ("EndiannessNumpy" , dtype .byteorder )
You can’t perform that action at this time.
0 commit comments