@@ -512,18 +512,17 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
512512 Self :: from_owned_ptr ( py, ptr)
513513 }
514514
515- pub ( crate ) unsafe fn from_raw_parts < ' py , ID , C > (
515+ pub ( crate ) unsafe fn from_raw_parts < ' py , ID > (
516516 py : Python < ' py > ,
517517 dims : ID ,
518518 strides : * const npy_intp ,
519519 data_ptr : * const T ,
520- container : C ,
520+ container : PySliceContainer ,
521521 ) -> & ' py Self
522522 where
523523 ID : IntoDimension < Dim = D > ,
524- PySliceContainer : From < C > ,
525524 {
526- let container = PyClassInitializer :: from ( PySliceContainer :: from ( container) )
525+ let container = PyClassInitializer :: from ( container)
527526 . create_cell ( py)
528527 . expect ( "Failed to create slice container" ) ;
529528
@@ -679,7 +678,15 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
679678 pub fn from_owned_array < ' py > ( py : Python < ' py > , mut arr : Array < T , D > ) -> & ' py Self {
680679 let ( strides, dims) = ( arr. npy_strides ( ) , arr. raw_dim ( ) ) ;
681680 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+ }
683690 }
684691
685692 /// Get a reference of the specified element if the given index is valid.
@@ -1074,7 +1081,15 @@ impl<D: Dimension> PyArray<PyObject, D> {
10741081 pub fn from_owned_object_array < ' py , T > ( py : Python < ' py > , mut arr : Array < Py < T > , D > ) -> & ' py Self {
10751082 let ( strides, dims) = ( arr. npy_strides ( ) , arr. raw_dim ( ) ) ;
10761083 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+ }
10781093 }
10791094}
10801095
0 commit comments