Skip to content

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