update `py.import` -> `py.import_bound` in benches (#3868)

This commit is contained in:
David Hewitt 2024-02-19 22:15:36 +00:00 committed by GitHub
parent 96b8c9facf
commit 9a36b50789
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -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());
}); });