8000 _dtype_from_pep3118 is non-deterministic given zero-sized elements · Issue #9053 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
_dtype_from_pep3118 is non-deterministic given zero-sized elements #9053
Closed
@bmerry

Description

@bmerry

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0