-
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
Return mutable array from rust to python #185
Comments
|
Thanks for your answer. Unfortunately, I still struggle to write to an array, which was allocated via rust-numpy. Maybe you can spot a mistake? fn ret_some_array<'py>(&self, py: Python<'py>) -> PyResult<&'py PyArray1<f32>> {
let v = vec![1f32; 10];
Ok(v.into_pyarray(py))
} On the python side I get the following error: a = ret_some_array()
print(a.flags)
# a.setflags(write=True) # -> ValueError: cannot set WRITEABLE flag to True of this array
# a[0] = 0 # -> ValueError: assignment destination is read-only flags:
|
|
@Rikorose |
I keep this issue opening until I fix this inconsistent API issue. |
Suppress warnings due to PyO3/rust-numpy#185
Suppress warnings due to PyO3/rust-numpy#185
I don't really follow the reasoning here. The underlying |
Suppress warnings due to PyO3/rust-numpy#185
It would be nice to have a function like
into_pyarray_mut
to be able to do the following:Is this possible in a safe way?
The text was updated successfully, but these errors were encountered: