Skip to content
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

Add PyArray::borrow_from_array to expose array data with ownership being tied to anyother Python object #230

Merged
merged 1 commit into from
Jan 6, 2022
Merged

Conversation

adamreichold
Copy link
Member

@adamreichold adamreichold commented Dec 29, 2021

Fixes #154

@aldanor
Copy link
Contributor

aldanor commented Dec 29, 2021

@adamreichold Yes, I guess this is pretty much what I meant 👍

I think if it works out, it will resolve the original issue (in fact, if it does, it may be even worthwhile adding a simplest example, with a pyclass holding two different arrays and exposing them via getters?).

@adamreichold
Copy link
Member Author

I think if it works out, it will resolve the original issue (in fact, if it does, it may be even worthwhile adding a simplest example, with a pyclass holding two different arrays and exposing them via getters?).

Will add the example after I figured out the CI issues. I would be glad if you could give this a try within your actual environment as I am not too confident about the unit test.

@adamreichold
Copy link
Member Author

a simplest example, with a pyclass holding two different arrays and exposing them via getters?

I think, a single field as in the unit test is actually enough.

@adamreichold adamreichold marked this pull request as ready for review December 29, 2021 19:36
Copy link
Member

@kngwyu kngwyu left a comment

Choose a reason for hiding this comment

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

Thank you! This is an apparently dangerous API but I'm happy to have this if there are some demands.

src/array.rs Outdated Show resolved Hide resolved
src/array.rs Outdated Show resolved Hide resolved
@adamreichold
Copy link
Member Author

This is an apparently dangerous API

Indeed. I just noticed that I very much messed up the type signature. Pushed a fixed version.

src/array.rs Outdated Show resolved Hide resolved
@kngwyu
Copy link
Member

kngwyu commented Jan 6, 2022

Thanks!

@kngwyu kngwyu merged commit be28ad3 into PyO3:main Jan 6, 2022
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.

Exposing multiple array-like fields of a pyclass
3 participants