@@ -13,7 +13,7 @@ use numpy::{
1313use pyo3:: {
1414 py_run, pyclass, pymethods,
1515 types:: { IntoPyDict , PyAnyMethods , PyDict , PyList } ,
16- Bound , IntoPy , Py , PyAny , PyResult , Python ,
16+ Bound , Py , PyResult , Python ,
1717} ;
1818
1919fn get_np_locals < ' py > ( py : Python < ' py > ) -> & ' py PyDict {
@@ -430,7 +430,7 @@ fn borrow_from_array_works() {
430430#[ test]
431431fn downcasting_works ( ) {
432432 Python :: with_gil ( |py| {
433- let ob: & PyAny = PyArray :: from_slice ( py, & [ 1_i32 , 2 , 3 ] ) ;
433+ let ob = PyArray :: from_slice_bound ( py, & [ 1_i32 , 2 , 3 ] ) . into_any ( ) ;
434434
435435 assert ! ( ob. downcast:: <PyArray1 <i32 >>( ) . is_ok( ) ) ;
436436 } ) ;
@@ -439,7 +439,7 @@ fn downcasting_works() {
439439#[ test]
440440fn downcasting_respects_element_type ( ) {
441441 Python :: with_gil ( |py| {
442- let ob: & PyAny = PyArray :: from_slice ( py, & [ 1_i32 , 2 , 3 ] ) ;
442+ let ob = PyArray :: from_slice_bound ( py, & [ 1_i32 , 2 , 3 ] ) . into_any ( ) ;
443443
444444 assert ! ( ob. downcast:: <PyArray1 <f64 >>( ) . is_err( ) ) ;
445445 } ) ;
@@ -448,18 +448,18 @@ fn downcasting_respects_element_type() {
448448#[ test]
449449fn downcasting_respects_dimensionality ( ) {
450450 Python :: with_gil ( |py| {
451- let ob: & PyAny = PyArray :: from_slice ( py, & [ 1_i32 , 2 , 3 ] ) ;
451+ let ob = PyArray :: from_slice_bound ( py, & [ 1_i32 , 2 , 3 ] ) . into_any ( ) ;
452452
453453 assert ! ( ob. downcast:: <PyArray2 <i32 >>( ) . is_err( ) ) ;
454454 } ) ;
455455}
456456
457457#[ test]
458- fn into_py_works ( ) {
458+ fn unbind_works ( ) {
459459 let arr: Py < PyArray1 < _ > > = Python :: with_gil ( |py| {
460- let arr = PyArray :: from_slice ( py, & [ 1_i32 , 2 , 3 ] ) ;
460+ let arr = PyArray :: from_slice_bound ( py, & [ 1_i32 , 2 , 3 ] ) ;
461461
462- arr. into_py ( py )
462+ arr. unbind ( )
463463 } ) ;
464464
465465 Python :: with_gil ( |py| {
@@ -472,10 +472,10 @@ fn into_py_works() {
472472#[ test]
473473fn to_owned_works ( ) {
474474 let arr: Py < PyArray1 < _ > > = Python :: with_gil ( |py| {
475- let arr = PyArray :: from_slice ( py, & [ 1_i32 , 2 , 3 ] ) ;
475+ let arr = PyArray :: from_slice_bound ( py, & [ 1_i32 , 2 , 3 ] ) ;
476476
477477 #[ allow( deprecated) ]
478- arr. to_owned ( )
478+ arr. as_gil_ref ( ) . to_owned ( )
479479 } ) ;
480480
481481 Python :: with_gil ( |py| {
0 commit comments