@@ -676,9 +676,9 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
676
676
/// assert_eq!(pyarray.readonly().as_array(), array![[1, 2], [3, 4]]);
677
677
/// });
678
678
/// ```
679
- pub fn from_owned_array < ' py > ( py : Python < ' py > , arr : Array < T , D > ) -> & ' py Self {
679
+ pub fn from_owned_array < ' py > ( py : Python < ' py > , mut arr : Array < T , D > ) -> & ' py Self {
680
680
let ( strides, dims) = ( arr. npy_strides ( ) , arr. raw_dim ( ) ) ;
681
- let data_ptr = arr. as_ptr ( ) ;
681
+ let data_ptr = arr. as_mut_ptr ( ) ;
682
682
unsafe { Self :: from_raw_parts ( py, dims, strides. as_ptr ( ) , data_ptr, arr) }
683
683
}
684
684
@@ -1071,9 +1071,9 @@ impl<D: Dimension> PyArray<PyObject, D> {
1071
1071
/// assert!(pyarray.readonly().as_array().get(0).unwrap().as_ref(py).is_instance_of::<CustomElement>().unwrap());
1072
1072
/// });
1073
1073
/// ```
1074
- pub fn from_owned_object_array < ' py , T > ( py : Python < ' py > , arr : Array < Py < T > , D > ) -> & ' py Self {
1074
+ pub fn from_owned_object_array < ' py , T > ( py : Python < ' py > , mut arr : Array < Py < T > , D > ) -> & ' py Self {
1075
1075
let ( strides, dims) = ( arr. npy_strides ( ) , arr. raw_dim ( ) ) ;
1076
- let data_ptr = arr. as_ptr ( ) as * const PyObject ;
1076
+ let data_ptr = arr. as_mut_ptr ( ) as * const PyObject ;
1077
1077
unsafe { PyArray :: from_raw_parts ( py, dims, strides. as_ptr ( ) , data_ptr, arr) }
1078
1078
}
1079
1079
}
0 commit comments