Skip to content

Commit

Permalink
fix compiler error in benches target
Browse files Browse the repository at this point in the history
  • Loading branch information
ngoldbaum committed Feb 12, 2025
1 parent 94348d1 commit 2b9ccf2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions benches/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use test::{black_box, Bencher};
use std::ops::Range;

use numpy::{PyArray1, PyArray2, PyArray3};
use pyo3::{types::PyAnyMethods, Bound, Python};
use pyo3::{types::PyAnyMethods, Bound, IntoPyObjectExt, Python};

#[bench]
fn extract_success(bencher: &mut Bencher) {
Expand Down Expand Up @@ -115,7 +115,11 @@ fn from_slice_large(bencher: &mut Bencher) {
}

fn from_object_slice(bencher: &mut Bencher, size: usize) {
let vec = Python::with_gil(|py| (0..size).map(|val| val.to_object(py)).collect::<Vec<_>>());
let vec = Python::with_gil(|py| {
(0..size)
.map(|val| val.into_py_any(py).unwrap())
.collect::<Vec<_>>()
});

Python::with_gil(|py| {
bencher.iter(|| {
Expand Down

0 comments on commit 2b9ccf2

Please sign in to comment.