update `py.import` -> `py.import_bound` in benches (#3868)
This commit is contained in:
parent
96b8c9facf
commit
9a36b50789
|
@ -6,7 +6,7 @@ use pyo3::intern;
|
||||||
|
|
||||||
fn getattr_direct(b: &mut Bencher<'_>) {
|
fn getattr_direct(b: &mut Bencher<'_>) {
|
||||||
Python::with_gil(|py| {
|
Python::with_gil(|py| {
|
||||||
let sys = py.import("sys").unwrap();
|
let sys = py.import_bound("sys").unwrap();
|
||||||
|
|
||||||
b.iter(|| sys.getattr("version").unwrap());
|
b.iter(|| sys.getattr("version").unwrap());
|
||||||
});
|
});
|
||||||
|
@ -14,7 +14,7 @@ fn getattr_direct(b: &mut Bencher<'_>) {
|
||||||
|
|
||||||
fn getattr_intern(b: &mut Bencher<'_>) {
|
fn getattr_intern(b: &mut Bencher<'_>) {
|
||||||
Python::with_gil(|py| {
|
Python::with_gil(|py| {
|
||||||
let sys = py.import("sys").unwrap();
|
let sys = py.import_bound("sys").unwrap();
|
||||||
|
|
||||||
b.iter(|| sys.getattr(intern!(py, "version")).unwrap());
|
b.iter(|| sys.getattr(intern!(py, "version")).unwrap());
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue