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};
6
6
use std:: ops:: Range ;
7
7
8
8
use numpy:: { PyArray1 , PyArray2 , PyArray3 } ;
9
- use pyo3:: { types:: PyAnyMethods , Bound , Python } ;
9
+ use pyo3:: { types:: PyAnyMethods , Bound , IntoPyObjectExt , Python } ;
10
10
11
11
#[ bench]
12
12
fn extract_success ( bencher : & mut Bencher ) {
@@ -115,7 +115,11 @@ fn from_slice_large(bencher: &mut Bencher) {
115
115
}
116
116
117
117
fn 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
+ } ) ;
119
123
120
124
Python :: with_gil ( |py| {
121
125
bencher. iter ( || {
You can’t perform that action at this time.
0 commit comments