ndarray: Fix memoryview(ulab.array(...))#329
Merged
v923z merged 1 commit intov923z:legacyfrom Feb 19, 2021
Merged
Conversation
For now this only handles the 1D case. In theory it would work for any dense array, however, I found that ndarray_is_dense didn't behave for me so I implemented this instead. Add a test. Before the change, this test would segfault. Closes #328.
v923z
reviewed
Feb 19, 2021
| // buffer_p.get_buffer() returns zero for success, while mp_get_buffer returns true for success | ||
| return !mp_get_buffer(self->array, bufinfo, flags); | ||
| if (self->ndim != 1 || self->strides[0] > 1) { | ||
| // For now, only allow fetching buffer of a 1d-array |
Owner
There was a problem hiding this comment.
This should be OK, though, while we can't specify the shape anyway. Once #305 is done, one could initialise from a buffer with shape and strides.
Owner
Owner
@jepler Do you mean that the function is corrupt? I might have to look into that, then. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For now this only handles the 1D case. In theory it would work for any dense array, however, I found that
ndarray_is_densedidn't behave for me so I implemented this instead.Add a test. Before the change, this test would segfault.
Closes #328.