@@ -512,18 +512,17 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
512
512
Self :: from_owned_ptr ( py, ptr)
513
513
}
514
514
515
- pub ( crate ) unsafe fn from_raw_parts < ' py , ID , C > (
515
+ pub ( crate ) unsafe fn from_raw_parts < ' py , ID > (
516
516
py : Python < ' py > ,
517
517
dims : ID ,
518
518
strides : * const npy_intp ,
519
519
data_ptr : * const T ,
520
- container : C ,
520
+ container : PySliceContainer ,
521
521
) -> & ' py Self
522
522
where
523
523
ID : IntoDimension < Dim = D > ,
524
- PySliceContainer : From < C > ,
525
524
{
526
- let container = PyClassInitializer :: from ( PySliceContainer :: from ( container) )
525
+ let container = PyClassInitializer :: from ( container)
527
526
. create_cell ( py)
528
527
. expect ( "Failed to create slice container" ) ;
529
528
@@ -679,7 +678,15 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
679
678
pub fn from_owned_array < ' py > ( py : Python < ' py > , mut arr : Array < T , D > ) -> & ' py Self {
680
679
let ( strides, dims) = ( arr. npy_strides ( ) , arr. raw_dim ( ) ) ;
681
680
let data_ptr = arr. as_mut_ptr ( ) ;
682
- unsafe { Self :: from_raw_parts ( py, dims, strides. as_ptr ( ) , data_ptr, arr) }
681
+ unsafe {
682
+ Self :: from_raw_parts (
683
+ py,
684
+ dims,
685
+ strides. as_ptr ( ) ,
686
+ data_ptr,
687
+ PySliceContainer :: from ( arr) ,
688
+ )
689
+ }
683
690
}
684
691
685
692
/// Get a reference of the specified element if the given index is valid.
@@ -1074,7 +1081,15 @@ impl<D: Dimension> PyArray<PyObject, D> {
1074
1081
pub fn from_owned_object_array < ' py , T > ( py : Python < ' py > , mut arr : Array < Py < T > , D > ) -> & ' py Self {
1075
1082
let ( strides, dims) = ( arr. npy_strides ( ) , arr. raw_dim ( ) ) ;
1076
1083
let data_ptr = arr. as_mut_ptr ( ) as * const PyObject ;
1077
- unsafe { PyArray :: from_raw_parts ( py, dims, strides. as_ptr ( ) , data_ptr, arr) }
1084
+ unsafe {
1085
+ Self :: from_raw_parts (
1086
+ py,
1087
+ dims,
1088
+ strides. as_ptr ( ) ,
1089
+ data_ptr,
1090
+ PySliceContainer :: from ( arr) ,
1091
+ )
1092
+ }
1078
1093
}
1079
1094
}
1080
1095
0 commit comments