-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
BUG: Fix Ticket #2187 #401
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
Conversation
Fix returned copy so that copy of view with offsets copies only fields in view, not all the fields from original array. Also add unit tests to make sure this doesn't break when copy is fully deprecated in favor of returning a view.
Thanks a lot for this! Let me test it. |
After this PR, this is what I get:
(See the original ticket: http://projects.scipy.org/numpy/ticket/2187), so that's good. |
And before the PR, I get:
So I think that this fixes it! |
# Return a copy for now until behavior is fully deprecated | ||
# in favor of returning view | ||
copy_dtype = {'names':view_dtype['names'], 'formats':view_dtype['formats']} | ||
from numpy import array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This "array" should be imported from the line from multiarray import empty, dtype, array
in the same function. I'll fix it in the next patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #404.
Fix for ticket #2187.
When indexing with subset of fields, returning a copy is being deprecated in favor of returning a view. For now a copy is still returned, but it's a copy of the view that will be eventually returned. Fix returned copy so that copy of view with offsets copies only fields in view, not all the fields from original array. Also add unit tests to make sure this doesn't break when copy is fully deprecated in favor of returning a view.
Additional changes will need to be made when returning a copy is fully deprecated.