Skip to content

Make the internal PyArray::data function safe #304

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

Merged
merged 1 commit into from
Mar 23, 2022
Merged

Conversation

adamreichold
Copy link
Member

Noticed this while working on #299: While doing anything with the resulting pointer requires unsafe, producing the pointer should not. (Dereferencing self.as_array_ptr() should be safe for the same reasons that dereferencing it in say PyArray::shape is,
i.e. we ensure that PyArray<T,D> is only constructed for NumPy arrays.)

While doing anything with the resulting pointer requires unsafe,
producing the pointer should not. (Dereferencing `self.as_array_ptr()`
should be safe for the same reasons that dereferencing it in say `PyArray::shape` is,
i.e. we ensure that `PyArray<T,D>` is only constructed for NumPy arrays.)
Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

Yep, agreed!

@adamreichold adamreichold merged commit ca2be4e into main Mar 23, 2022
@adamreichold adamreichold deleted the safe-data branch March 23, 2022 11:03
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.

2 participants