@@ -229,6 +229,7 @@ impl<T, D> PyArray<T, D> {
229229 /// assert_eq!(array.bind(py).readonly().as_slice().unwrap(), [0.0; 5]);
230230 /// });
231231 /// ```
232+ #[ deprecated( since = "0.21.0" , note = "use Bound::unbind() instead" ) ]
232233 pub fn to_owned ( & self ) -> Py < Self > {
233234 unsafe { Py :: from_borrowed_ptr ( self . py ( ) , self . as_ptr ( ) ) }
234235 }
@@ -238,6 +239,7 @@ impl<T, D> PyArray<T, D> {
238239 /// # Safety
239240 ///
240241 /// This is a wrapper around [`pyo3::FromPyPointer::from_owned_ptr_or_opt`] and inherits its safety contract.
242+ #[ deprecated( since = "0.21.0" , note = "use Bound::from_owned_ptr() instead" ) ]
241243 pub unsafe fn from_owned_ptr < ' py > ( py : Python < ' py > , ptr : * mut ffi:: PyObject ) -> & ' py Self {
242244 #![ allow( deprecated) ]
243245 py. from_owned_ptr ( ptr)
@@ -248,6 +250,7 @@ impl<T, D> PyArray<T, D> {
248250 /// # Safety
249251 ///
250252 /// This is a wrapper around [`pyo3::FromPyPointer::from_borrowed_ptr_or_opt`] and inherits its safety contract.
253+ #[ deprecated( since = "0.21.0" , note = "use Bound::from_borrowed_ptr() instead" ) ]
251254 pub unsafe fn from_borrowed_ptr < ' py > ( py : Python < ' py > , ptr : * mut ffi:: PyObject ) -> & ' py Self {
252255 #![ allow( deprecated) ]
253256 py. from_borrowed_ptr ( ptr)
@@ -577,6 +580,10 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
577580 ///
578581 /// # Safety
579582 /// Same as [`PyArray<T, D>::new_bound`]
583+ #[ deprecated(
584+ since = "0.21.0" ,
585+ note = "will be replaced by `PyArray::new_bound` in the future"
586+ ) ]
580587 pub unsafe fn new < ' py , ID > ( py : Python < ' py > , dims : ID , is_fortran : bool ) -> & Self
581588 where
582589 ID : IntoDimension < Dim = D > ,
@@ -588,6 +595,10 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
588595 ///
589596 /// # Safety
590597 /// Same as [`PyArray<T, D>::borrow_from_array_bound`]
598+ #[ deprecated(
599+ since = "0.21.0" ,
600+ note = "will be replaced by `PyArray::borrow_from_array_bound` in the future"
601+ ) ]
591602 pub unsafe fn borrow_from_array < ' py , S > (
592603 array : & ArrayBase < S , D > ,
593604 container : & ' py PyAny ,
@@ -599,6 +610,10 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
599610 }
600611
601612 /// Deprecated form of [`PyArray<T, D>::zeros_bound`]
613+ #[ deprecated(
614+ since = "0.21.0" ,
615+ note = "will be replaced by `PyArray::zeros_bound` in the future"
616+ ) ]
602617 pub fn zeros < ' py , ID > ( py : Python < ' py > , dims : ID , is_fortran : bool ) -> & Self
603618 where
604619 ID : IntoDimension < Dim = D > ,
@@ -641,6 +656,10 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
641656 }
642657
643658 /// Deprecated form of [`PyArray<T, D>::from_owned_array_bound`]
659+ #[ deprecated(
660+ since = "0.21.0" ,
661+ note = "will be replaced by PyArray::from_owned_array_bound in the future"
662+ ) ]
644663 pub fn from_owned_array < ' py > ( py : Python < ' py > , arr : Array < T , D > ) -> & ' py Self {
645664 Self :: from_owned_array_bound ( py, arr) . into_gil_ref ( )
646665 }
@@ -821,6 +840,10 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
821840 }
822841
823842 /// Deprecated form of [`PyArray<T, D>::from_array_bound`]
843+ #[ deprecated(
844+ since = "0.21.0" ,
845+ note = "will be replaced by PyArray::from_array_bound in the future"
846+ ) ]
824847 pub fn from_array < ' py , S > ( py : Python < ' py > , arr : & ArrayBase < S , D > ) -> & ' py Self
825848 where
826849 S : Data < Elem = T > ,
@@ -981,6 +1004,10 @@ where
9811004impl < D : Dimension > PyArray < PyObject , D > {
9821005 /// Deprecated form of [`PyArray<T, D>::from_owned_object_array_bound`]
9831006 #[ cfg( feature = "gil-refs" ) ]
1007+ #[ deprecated(
1008+ since = "0.21.0" ,
1009+ note = "will be replaced by PyArray::from_owned_object_array_bound in the future"
1010+ ) ]
9841011 pub fn from_owned_object_array < ' py , T > ( py : Python < ' py > , arr : Array < Py < T > , D > ) -> & ' py Self {
9851012 Self :: from_owned_object_array_bound ( py, arr) . into_gil_ref ( )
9861013 }
@@ -1119,17 +1146,29 @@ impl<T: Element> PyArray<T, Ix1> {
11191146#[ cfg( feature = "gil-refs" ) ]
11201147impl < T : Element > PyArray < T , Ix1 > {
11211148 /// Deprecated form of [`PyArray<T, Ix1>::from_slice_bound`]
1149+ #[ deprecated(
1150+ since = "0.21.0" ,
1151+ note = "will be replaced by `PyArray::from_slice_bound` in the future"
1152+ ) ]
11221153 pub fn from_slice < ' py > ( py : Python < ' py > , slice : & [ T ] ) -> & ' py Self {
11231154 Self :: from_slice_bound ( py, slice) . into_gil_ref ( )
11241155 }
11251156
11261157 /// Deprecated form of [`PyArray<T, Ix1>::from_vec_bound`]
11271158 #[ inline( always) ]
1159+ #[ deprecated(
1160+ since = "0.21.0" ,
1161+ note = "will be replaced by `PyArray::from_vec_bound` in the future"
1162+ ) ]
11281163 pub fn from_vec < ' py > ( py : Python < ' py > , vec : Vec < T > ) -> & ' py Self {
11291164 Self :: from_vec_bound ( py, vec) . into_gil_ref ( )
11301165 }
11311166
11321167 /// Deprecated form of [`PyArray<T, Ix1>::from_iter_bound`]
1168+ #[ deprecated(
1169+ since = "0.21.0" ,
1170+ note = "will be replaced by PyArray::from_iter_bound in the future"
1171+ ) ]
11331172 pub fn from_iter < ' py , I > ( py : Python < ' py > , iter : I ) -> & ' py Self
11341173 where
11351174 I : IntoIterator < Item = T > ,
@@ -1141,6 +1180,10 @@ impl<T: Element> PyArray<T, Ix1> {
11411180impl < T : Element > PyArray < T , Ix2 > {
11421181 /// Deprecated form of [`PyArray<T, Ix2>::from_vec2_bound`]
11431182 #[ cfg( feature = "gil-refs" ) ]
1183+ #[ deprecated(
1184+ since = "0.21.0" ,
1185+ note = "will be replaced by `PyArray::from_vec2_bound` in the future"
1186+ ) ]
11441187 pub fn from_vec2 < ' py > ( py : Python < ' py > , v : & [ Vec < T > ] ) -> Result < & ' py Self , FromVecError > {
11451188 Self :: from_vec2_bound ( py, v) . map ( Bound :: into_gil_ref)
11461189 }
@@ -1191,6 +1234,10 @@ impl<T: Element> PyArray<T, Ix2> {
11911234impl < T : Element > PyArray < T , Ix3 > {
11921235 /// Deprecated form of [`PyArray<T, Ix3>::from_vec3_bound`]
11931236 #[ cfg( feature = "gil-refs" ) ]
1237+ #[ deprecated(
1238+ since = "0.21.0" ,
1239+ note = "will be replaced by `PyArray::from_vec3_bound` in the future"
1240+ ) ]
11941241 pub fn from_vec3 < ' py > ( py : Python < ' py > , v : & [ Vec < Vec < T > > ] ) -> Result < & ' py Self , FromVecError > {
11951242 Self :: from_vec3_bound ( py, v) . map ( Bound :: into_gil_ref)
11961243 }
@@ -1428,6 +1475,10 @@ impl<T: Element, D> PyArray<T, D> {
14281475impl < T : Element + AsPrimitive < f64 > > PyArray < T , Ix1 > {
14291476 /// Deprecated form of [`PyArray<T, Ix1>::arange_bound`]
14301477 #[ cfg( feature = "gil-refs" ) ]
1478+ #[ deprecated(
1479+ since = "0.21.0" ,
1480+ note = "will be replaced by PyArray::arange_bound in the future"
1481+ ) ]
14311482 pub fn arange < ' py > ( py : Python < ' py > , start : T , stop : T , step : T ) -> & Self {
14321483 Self :: arange_bound ( py, start, stop, step) . into_gil_ref ( )
14331484 }
0 commit comments