From 9efa9608b28867daf1f9a018187531c5a357b6c9 Mon Sep 17 00:00:00 2001 From: ZJaume Date: Mon, 18 Nov 2024 13:41:23 +0100 Subject: [PATCH] Upgrade to PyO3 0.23 --- Cargo.toml | 2 +- src/python.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e288081..bc06b54 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 } diff --git a/src/python.rs b/src/python.rs index 58880f3..35c309e 100644 --- a/src/python.rs +++ b/src/python.rs @@ -12,12 +12,12 @@ pub fn module_path() -> PyResult { 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 = module .getattr("__path__")? .extract()?; // __path__ attribute returns a list of paths, return first - path.push(paths[0]); + path.push(&paths[0]); Ok(path) }) }