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

BUG: Unpickled void scalars should be contiguous #7141

Merged
merged 2 commits into from
Jan 29, 2016

Conversation

gmarkall
Copy link
Contributor

Void scalars are both C- and Fortran-contiguous, so pickling and
unpickling them should result in a new void scalar that also has
these flags set. Fixes #7140.

Void scalars are both C- and Fortran-contiguous, so pickling and
unpickling them should result in a new void scalar that also has
these flags set. Fixes numpy#7140.
@@ -799,7 +799,7 @@ PyArray_Scalar(void *data, PyArray_Descr *descr, PyObject *base)
Py_INCREF(descr);
vobj->obval = NULL;
Py_SIZE(vobj) = itemsize;
vobj->flags = NPY_ARRAY_BEHAVED | NPY_ARRAY_OWNDATA;
vobj->flags = NPY_ARRAY_CARRAY | NPY_ARRAY_F_CONTIGUOUS | NPY_ARRAY_OWNDATA;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the reason you removed NPY_ARRAY_BEHAVED? (aligned and writeable)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, can you please make sure there is a test for this as well though, or add one if there is not?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can - I will look at this now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the aligned and writeable flags didn't cause any test failures, so I've added checks for both of them to the test_pickle_3 test as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some alignment features only matter on Sun hardware. I don't know if that affects this or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have access to any Sun hardware (I presume SPARC machines?) but I think I've avoided changing the aligned flag here - is there anything else I can look into related to this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that should't be necessary, alignment should be handled correctly and if not well deal with it when it causes a problem
most platforms don't care about alignment anyway, at worst you have software handling on those and some slowdown which is irrelevant for scalars.

Unpickled void scalars must be both aligned and writeable.
juliantaylor added a commit that referenced this pull request Jan 29, 2016
BUG: Unpickled void scalars should be contiguous
@juliantaylor juliantaylor merged commit 1436ec3 into numpy:master Jan 29, 2016
@juliantaylor
Copy link
Contributor

thanks!

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.

None yet

4 participants