File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ use test::{black_box, Bencher};
66use std:: ops:: Range ;
77
88use numpy:: { PyArray1 , PyArray2 , PyArray3 } ;
9- use pyo3:: { types:: PyAnyMethods , Bound , Python } ;
9+ use pyo3:: { types:: PyAnyMethods , Bound , IntoPyObjectExt , Python } ;
1010
1111#[ bench]
1212fn extract_success ( bencher : & mut Bencher ) {
@@ -115,7 +115,11 @@ fn from_slice_large(bencher: &mut Bencher) {
115115}
116116
117117fn from_object_slice ( bencher : & mut Bencher , size : usize ) {
118- let vec = Python :: with_gil ( |py| ( 0 ..size) . map ( |val| val. to_object ( py) ) . collect :: < Vec < _ > > ( ) ) ;
118+ let vec = Python :: with_gil ( |py| {
119+ ( 0 ..size)
120+ . map ( |val| val. into_py_any ( py) . unwrap ( ) )
121+ . collect :: < Vec < _ > > ( )
122+ } ) ;
119123
120124 Python :: with_gil ( |py| {
121125 bencher. iter ( || {
You can’t perform that action at this time.
0 commit comments