Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numpy 1.9 on my Centos build chops int64s into two int32s #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LeeKamentsky
Copy link
Contributor

This bug fixes some problems I'm seeing on our Linux build. I'm not sure if this is a change in behavior in Numpy 1.9 or is something caused by differences in the way the arrays are built. The basic problem is this construct:

> import numpy
> dtype = numpy.dtype([("A", "int32", "B", "int32")])
> a = numpy.array([[1, 2]], int).view(dtype)
> a.shape
(2, 1)

The problem is that "view" looks at the buffer, (0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,) and looks at the dtype which is two integers at four bytes apiece and carves the 16 bytes above into two 8 byte rows. The solution is to explicitly type arrays as numpy.int32 when this construct is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant