Closed
Description
In numpy 1.12.1, this code gives non-deterministic results, I'm guessing because the original field order is not preserved (the fields
local variable is a dict rather than an OrderedDict):
>>> print(np.core._internal._dtype_from_pep3118("(0)I:a:f:f:"))
In some cases the output is [('a', '<u4', (0,)), ('f', '<f4')]
, in others it is {'names':['f','a'], 'formats':['<f4',('<u4', (0,))], 'offsets':[0,0], 'itemsize':4}
.
These dtypes are at least equal to each other, but it gets worse: given f:f:(0)Iempty:4x
, the padding is sometimes anonymous, and sometimes a field called pad0
. These dtypes aren't the same and can't be cast between each other with the 'safe' or 'equiv' rules.