ENH: PyArray_FromInterface checks descr if typestr is np.void#5519
ENH: PyArray_FromInterface checks descr if typestr is np.void#5519charris merged 1 commit intonumpy:masterfrom
Conversation
da38fb0 to
5d3026e
Compare
|
There is still a hole in the ability of numpy to fully reconstruct an array, including its dtype, using but if you really want it, you can get it: |
5d3026e to
69db6f5
Compare
|
Added a little logic to |
There was a problem hiding this comment.
Looks like tmp can be NULL, assuming that the string cannot be converted to ascii. I'm not sure what the policy for this codec is.
|
Looks like there may be some conflicts with #5371, so lets get that in first. You are welcome to merge it :0 |
|
@jaimefrio Needs rebase. |
69db6f5 to
56c0e21
Compare
|
Rebased it is. Still need to figure how to handle that potential failure in the ASCII conversion... |
56c0e21 to
af92638
Compare
When the 'typestr' member of the __array_interface__ dictionary defines a np.void dtype, check the 'descr' member, and if it is a valid dtype description and it is not the default one, use it to construct the dtype for the array to return. This fixes numpy#5081, as as_strided no longer has to worry about changing the dtype of the return.
af92638 to
0808ae8
Compare
|
I think I have now taken care of the possible error: if we cannot convert to ASCII, then it isn't the default |
There was a problem hiding this comment.
I like the way this condition is expressed better than the one above ;)
ENH: PyArray_FromInterface checks descr if typestr is np.void
|
LGTM, thanks Jaime. |
When the 'typestr' member of the array_interface dictionary defines
a np.void dtype, check the 'descr' member, and if it is a valid dtype
description and it is not the default one, use it to construct the
dtype for the array to return.
This fixes #5081, as as_strided no longer has to worry about changing
the dtype of the return.