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: ndarrays pickled by 1.16 cannot be loaded by 1.15.4 and lower #12869

Merged
merged 1 commit into from Jan 28, 2019

Conversation

charris
Copy link
Member

@charris charris commented Jan 27, 2019

Backport of #12842.

Fixes #12837
When pickling ndarrays, the pickle protocol adds the reconstructing function's modulename to the pickled string so it can be called. The function (which is_reconstruct) now lives in numpy.core._multiarray_umath, but in pre-1.16 numpy it was in numpy.core.multiarray. Also for scalar objects, the function scalar` moved.

The fix is very simple, changing the __module__ attribute of _reconstruct and scalar

In array_reduce_ex, used when the pickle protocol is 5, the function will be numpy.core.numeric._frombuffer, which will not exist on pre-1.16 numpy (added in commit 64a855f, Oct 2018). I don't think we can work around that. People who do not have that function will have to modify their numpy if they wish to import protocol-5 pickled ndarrays.

@charris charris added this to the 1.16.1 release milestone Jan 27, 2019
@charris charris merged commit 25e8aea into numpy:maintenance/1.16.x Jan 28, 2019
@charris charris deleted the backport-12842 branch January 28, 2019 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants