Skip to content

npy_format_descriptor may not be accurate for platform-dependent lengths of short, long, and long long #1328

Closed
@EricCousineau-TRI

Description

@EricCousineau-TRI

Ran into this via an esoteric route: When tinkering with user-defined dtypes, it seems that implementation of np.ones uses np.copyto(dst, 1, casting='unsafe'), where the 1 gets interpreted as np.array(1, dtype=np.int64) (at least, on my platform).

When I tried registered a caster using npy_descriptor_format<int64_t>::dtype() using the type_num field, I realized its value was for NPY_LONGLONG, whereas NPY_INT64 corresponds to NPY_LONG.

Will try to see if I can create a failing test, and then submit a tentative fix PR based on that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions