8000 fix cstr · RustPython/RustPython@5737271 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5737271

Browse files
committed
fix cstr
1 parent 8c031ce commit 5737271

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

benches/execution.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ use std::collections::HashMap;
99
use std::path::Path;
1010

1111
fn bench_cpython_code(b: &mut Bencher, source: &str) {
12+
let c_str_source_head = std::ffi::CString::new(source).unwrap();
13+
let c_str_source = c_str_source_head.as_c_str();
1214
pyo3::Python::with_gil(|py| {
1315
b.iter(|| {
14-
let module =
15-
pyo3::types::PyModule::from_code(py, source , c"", c"").expect("Error running source");
16+
let module = pyo3::types::PyModule::from_code(py, c_str_source, c"", c"")
17+
.expect("Error running source");
1618
black_box(module);
1719
})
1820
})

0 commit comments

Comments
 (0)
0