-
Notifications
You must be signed in to change notification settings - Fork 120
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
Adds into_pyarray to faer Mat #482
Open
wgurecky
wants to merge
6
commits into
PyO3:main
Choose a base branch
from
wgurecky:faer_compat
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bd1d494
adds into_pyarray to faer mat
wgurecky e0ec945
drop_faer_mat update
wgurecky d6d942f
cleanup and apply suggested lint fixes
wgurecky cd05009
formatting
davidhewitt 4c1ad1f
Merge branch 'main' into faer_compat
davidhewitt 9e6045f
bump faer version
wgurecky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
@ngoldbaum does
PyArray_NewFromDescr
copy the strides array or just store the pointer? This looks like a potential use-after-free 🤔(We already have the same pattern in the other
into_pyarray
functions in this file, which makes me think it's probably fine? Either that or there's a nasty bug inrust-numpy
already...)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.
There's an explicit copy if strides are passed in:
https://github.com/numpy/numpy/blob/a651643fc9b5699a6dc6f3c85ba499c1f52ce3aa/numpy/_core/src/multiarray/ctors.c#L801-L816
There's another code path that handles structured dtypes with subarrays but it looks like that copies the strides too.
There's a comment here worrying about unaligned input strides:
https://github.com/numpy/numpy/blob/a651643fc9b5699a6dc6f3c85ba499c1f52ce3aa/numpy/_core/src/multiarray/ctors.c#L911-L916
But also I have no idea why an unaligned stride array would ever be a problem.