@@ -229,6 +229,7 @@ impl<T, D> PyArray<T, D> {
229
229
/// assert_eq!(array.bind(py).readonly().as_slice().unwrap(), [0.0; 5]);
230
230
/// });
231
231
/// ```
232
+ #[ deprecated( since = "0.21.0" , note = "use Bound::unbind() instead" ) ]
232
233
pub fn to_owned ( & self ) -> Py < Self > {
233
234
unsafe { Py :: from_borrowed_ptr ( self . py ( ) , self . as_ptr ( ) ) }
234
235
}
@@ -238,6 +239,7 @@ impl<T, D> PyArray<T, D> {
238
239
/// # Safety
239
240
///
240
241
/// 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" ) ]
241
243
pub unsafe fn from_owned_ptr < ' py > ( py : Python < ' py > , ptr : * mut ffi:: PyObject ) -> & ' py Self {
242
244
#![ allow( deprecated) ]
243
245
py. from_owned_ptr ( ptr)
@@ -248,6 +250,7 @@ impl<T, D> PyArray<T, D> {
248
250
/// # Safety
249
251
///
250
252
/// 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" ) ]
251
254
pub unsafe fn from_borrowed_ptr < ' py > ( py : Python < ' py > , ptr : * mut ffi:: PyObject ) -> & ' py Self {
252
255
#![ allow( deprecated) ]
253
256
py. from_borrowed_ptr ( ptr)
@@ -577,6 +580,10 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
577
580
///
578
581
/// # Safety
579
582
/// 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
+ ) ]
580
587
pub unsafe fn new < ' py , ID > ( py : Python < ' py > , dims : ID , is_fortran : bool ) -> & Self
581
588
where
582
589
ID : IntoDimension < Dim = D > ,
@@ -588,6 +595,10 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
588
595
///
589
596
/// # Safety
590
597
/// 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
+ ) ]
591
602
pub unsafe fn borrow_from_array < ' py , S > (
592
603
array : & ArrayBase < S , D > ,
593
604
container : & ' py PyAny ,
@@ -599,6 +610,10 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
599
610
}
600
611
601
612
/// 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
+ ) ]
602
617
pub fn zeros < ' py , ID > ( py : Python < ' py > , dims : ID , is_fortran : bool ) -> & Self
603
618
where
604
619
ID : IntoDimension < Dim = D > ,
@@ -641,6 +656,10 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
641
656
}
642
657
643
658
/// 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
+ ) ]
644
663
pub fn from_owned_array < ' py > ( py : Python < ' py > , arr : Array < T , D > ) -> & ' py Self {
645
664
Self :: from_owned_array_bound ( py, arr) . into_gil_ref ( )
646
665
}
@@ -821,6 +840,10 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
821
840
}
822
841
823
842
/// 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
+ ) ]
824
847
pub fn from_array < ' py , S > ( py : Python < ' py > , arr : & ArrayBase < S , D > ) -> & ' py Self
825
848
where
826
849
S : Data < Elem = T > ,
@@ -981,6 +1004,10 @@ where
981
1004
impl < D : Dimension > PyArray < PyObject , D > {
982
1005
/// Deprecated form of [`PyArray<T, D>::from_owned_object_array_bound`]
983
1006
#[ 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
+ ) ]
984
1011
pub fn from_owned_object_array < ' py , T > ( py : Python < ' py > , arr : Array < Py < T > , D > ) -> & ' py Self {
985
1012
Self :: from_owned_object_array_bound ( py, arr) . into_gil_ref ( )
986
1013
}
@@ -1119,17 +1146,29 @@ impl<T: Element> PyArray<T, Ix1> {
1119
1146
#[ cfg( feature = "gil-refs" ) ]
1120
1147
impl < T : Element > PyArray < T , Ix1 > {
1121
1148
/// 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
+ ) ]
1122
1153
pub fn from_slice < ' py > ( py : Python < ' py > , slice : & [ T ] ) -> & ' py Self {
1123
1154
Self :: from_slice_bound ( py, slice) . into_gil_ref ( )
1124
1155
}
1125
1156
1126
1157
/// Deprecated form of [`PyArray<T, Ix1>::from_vec_bound`]
1127
1158
#[ inline( always) ]
1159
+ #[ deprecated(
1160
+ since = "0.21.0" ,
1161
+ note = "will be replaced by `PyArray::from_vec_bound` in the future"
1162
+ ) ]
1128
1163
pub fn from_vec < ' py > ( py : Python < ' py > , vec : Vec < T > ) -> & ' py Self {
1129
1164
Self :: from_vec_bound ( py, vec) . into_gil_ref ( )
1130
1165
}
1131
1166
1132
1167
/// 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
+ ) ]
1133
1172
pub fn from_iter < ' py , I > ( py : Python < ' py > , iter : I ) -> & ' py Self
1134
1173
where
1135
1174
I : IntoIterator < Item = T > ,
@@ -1141,6 +1180,10 @@ impl<T: Element> PyArray<T, Ix1> {
1141
1180
impl < T : Element > PyArray < T , Ix2 > {
1142
1181
/// Deprecated form of [`PyArray<T, Ix2>::from_vec2_bound`]
1143
1182
#[ 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
+ ) ]
1144
1187
pub fn from_vec2 < ' py > ( py : Python < ' py > , v : & [ Vec < T > ] ) -> Result < & ' py Self , FromVecError > {
1145
1188
Self :: from_vec2_bound ( py, v) . map ( Bound :: into_gil_ref)
1146
1189
}
@@ -1191,6 +1234,10 @@ impl<T: Element> PyArray<T, Ix2> {
1191
1234
impl < T : Element > PyArray < T , Ix3 > {
1192
1235
/// Deprecated form of [`PyArray<T, Ix3>::from_vec3_bound`]
1193
1236
#[ 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
+ ) ]
1194
1241
pub fn from_vec3 < ' py > ( py : Python < ' py > , v : & [ Vec < Vec < T > > ] ) -> Result < & ' py Self , FromVecError > {
1195
1242
Self :: from_vec3_bound ( py, v) . map ( Bound :: into_gil_ref)
1196
1243
}
@@ -1428,6 +1475,10 @@ impl<T: Element, D> PyArray<T, D> {
1428
1475
impl < T : Element + AsPrimitive < f64 > > PyArray < T , Ix1 > {
1429
1476
/// Deprecated form of [`PyArray<T, Ix1>::arange_bound`]
1430
1477
#[ cfg( feature = "gil-refs" ) ]
1478
+ #[ deprecated(
1479
+ since = "0.21.0" ,
1480
+ note = "will be replaced by PyArray::arange_bound in the future"
1481
+ ) ]
1431
1482
pub fn arange < ' py > ( py : Python < ' py > , start : T , stop : T , step : T ) -> & Self {
1432
1483
Self :: arange_bound ( py, start, stop, step) . into_gil_ref ( )
1433
1484
}
0 commit comments