fix: handle special uint32 arrays on Windows correctly#3797
fix: handle special uint32 arrays on Windows correctly#3797radoering wants to merge 2 commits intozarr-developers:mainfrom
Conversation
| # On Windows, this creates an UIntDType (instead of UInt32DType), | ||
| # similar to how np.dtype('i') creates an IntDType instead of Int32DType. | ||
| # However, np.dtype('u') raises a TypeError. | ||
| uint_dtype = (np.array([1], dtype=np.uint32) & 1).dtype |
There was a problem hiding this comment.
To create the special dtype. Without the & 1, it is UInt32Dtype, with & 1, it is UIntDtype.
There was a problem hiding this comment.
ok, thanks for the clarification. Why is numpy doing this?
There was a problem hiding this comment.
I have no idea. It took me a while to figure out how to create an array with such a dtype after I encountered this error in more complex code.
There was a problem hiding this comment.
yes I can imagine how frustrating that must have been. if this happens again we might need to consider relying on some kind of structural checks instead of trusting numpy's class hierarchy.
There was a problem hiding this comment.
I'm looking for reports of this on the numpy issue tracker, this one seems related: numpy/numpy#17351
Resolves: #3796
Changes are equivalent to #3151 just for
uint32.TODO:
docs/user-guide/*.mdchanges/