Skip to content

Commit 2b9ccf2

Browse files
committed
fix compiler error in benches target
1 parent 94348d1 commit 2b9ccf2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

benches/array.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use test::{black_box, Bencher};
66
use std::ops::Range;
77

88
use numpy::{PyArray1, PyArray2, PyArray3};
9-
use pyo3::{types::PyAnyMethods, Bound, Python};
9+
use pyo3::{types::PyAnyMethods, Bound, IntoPyObjectExt, Python};
1010

1111
#[bench]
1212
fn extract_success(bencher: &mut Bencher) {
@@ -115,7 +115,11 @@ fn from_slice_large(bencher: &mut Bencher) {
115115
}
116116

117117
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+
});
119123

120124
Python::with_gil(|py| {
121125
bencher.iter(|| {

0 commit comments

Comments
 (0)