Skip to content

Commit

Permalink
Upgrade to PyO3 0.23
Browse files Browse the repository at this point in the history
  • Loading branch information
ZJaume committed Nov 18, 2024
1 parent 3b76421 commit 9efa960
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ordered-float = "4.2"
log = { version = "0.4" }
env_logger = "0.10"
strum = { version = "0.25", features = ["derive"] }
pyo3 = { version = "0.22", features = ["gil-refs", "anyhow"], optional = true }
pyo3 = { version = "0.23", features = ["anyhow"], optional = true }
target = { version = "2.1.0", optional = true }
tempfile = { version = "3", optional = true }
reqwest = { version = "0.12", features = ["stream", "rustls-tls"], optional = true }
Expand Down
6 changes: 3 additions & 3 deletions src/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ pub fn module_path() -> PyResult<PathBuf> {
let mut path = PathBuf::new();
Python::with_gil(|py| {
// Instead of hardcoding the module name, obtain it from the crate name at compile time
let module = PyModule::import_bound(py, env!("CARGO_PKG_NAME"))?;
let paths: Vec<&str> = module
let module = PyModule::import(py, env!("CARGO_PKG_NAME"))?;
let paths: Vec<String> = module
.getattr("__path__")?
.extract()?;
// __path__ attribute returns a list of paths, return first
path.push(paths[0]);
path.push(&paths[0]);
Ok(path)
})
}
Expand Down

0 comments on commit 9efa960

Please sign in to comment.