Skip to content

Commit

Permalink
eyre-rs#198 - chore: bump pyo3 to version 0.23.1
Browse files Browse the repository at this point in the history
- Refactored eyre/tests/test_pyo3.rs to support pyo3 version upgrade.
  • Loading branch information
afmireski committed Nov 24, 2024
1 parent 8addc8f commit bc67449
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 123 deletions.
125 changes: 7 additions & 118 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions eyre/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ track-caller = []
[dependencies]
indenter = { workspace = true }
once_cell = { workspace = true }
pyo3 = { version = "0.20", optional = true, default-features = false }
pyo3 = { version = "0.23.1", optional = true, default-features = false }

[build-dependencies]
autocfg = { workspace = true }
Expand All @@ -34,7 +34,7 @@ trybuild = { version = "=1.0.89", features = ["diff"] } # pinned due to MSRV
backtrace = "0.3.46"
anyhow = "1.0.28"
syn = { version = "2.0", features = ["full"] }
pyo3 = { version = "0.20", default-features = false, features = ["auto-initialize"] }
pyo3 = { version = "0.23.1", default-features = false, features = ["auto-initialize"] }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
Expand Down
8 changes: 5 additions & 3 deletions eyre/tests/test_pyo3.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![cfg(feature = "pyo3")]

use pyo3::prelude::*;
use pyo3::{ffi::c_str, prelude::*};

use eyre::{bail, Result, WrapErr};

Expand All @@ -26,8 +26,10 @@ fn test_pyo3_exception_contents() {
let pyerr = PyErr::from(err);

Python::with_gil(|py| {
let locals = [("err", pyerr)].into_py_dict(py);
let pyerr = py.run("raise err", None, Some(locals)).unwrap_err();
let locals = [("err", pyerr)].into_py_dict(py).unwrap();
let pyerr = py
.run(c_str!("raise err"), None, Some(&locals))
.unwrap_err();
assert_eq!(pyerr.value(py).to_string(), expected_contents);
})
}

0 comments on commit bc67449

Please sign in to comment.