From d70bd9add7ae4900c065c1978094db97f72bab73 Mon Sep 17 00:00:00 2001 From: Steve Myers Date: Mon, 3 Jun 2024 16:34:41 -0500 Subject: [PATCH] deps(pyo3): update to 0.21.2 --- Cargo.toml | 2 +- src/interface.rs | 7 ++++--- src/types.rs | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 53ec9d6..942b65c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ readme = "README.md" bitcoin = { version = "0.31.0", features = ["serde", "base64"] } serde = { version = "^1.0", features = ["derive"] } serde_json = { version = "^1.0" } -pyo3 = { version = "0.15.1", features = ["auto-initialize"] } +pyo3 = { version = "0.21.2", features = ["auto-initialize"] } miniscript = { version = "11.0", features = ["serde"], optional = true } diff --git a/src/interface.rs b/src/interface.rs index f5745cb..c816bfb 100644 --- a/src/interface.rs +++ b/src/interface.rs @@ -36,8 +36,9 @@ struct HWILib { impl HWILib { pub fn initialize() -> Result { Python::with_gil(|py| { - let commands: Py = PyModule::import(py, "hwilib.commands")?.into(); - let json_dumps: Py = PyModule::import(py, "json")?.getattr("dumps")?.into(); + let commands: Py = PyModule::import_bound(py, "hwilib.commands")?.into(); + let json_dumps: Py = + PyModule::import_bound(py, "json")?.getattr("dumps")?.into(); Ok(HWILib { commands, json_dumps, @@ -497,7 +498,7 @@ impl HWIClient { pub fn get_version() -> Option { Python::with_gil(|py| { Some( - PyModule::import(py, "hwilib") + PyModule::import_bound(py, "hwilib") .ok()? .getattr("__version__") .expect("Should have a __version__") diff --git a/src/types.rs b/src/types.rs index db8ef8e..db25a24 100644 --- a/src/types.rs +++ b/src/types.rs @@ -15,6 +15,7 @@ use serde::{Deserialize, Deserializer}; #[cfg(feature = "miniscript")] use miniscript::{Descriptor, DescriptorPublicKey}; +use pyo3::prelude::PyAnyMethods; use crate::error::{Error, ErrorCode}; @@ -113,7 +114,7 @@ pub enum HWIAddressType { impl IntoPy for HWIAddressType { fn into_py(self, py: pyo3::Python) -> PyObject { - let addrtype = PyModule::import(py, "hwilib.common") + let addrtype = PyModule::import_bound(py, "hwilib.common") .unwrap() .getattr("AddressType") .unwrap(); @@ -133,7 +134,7 @@ impl IntoPy for HWIChain { fn into_py(self, py: pyo3::Python) -> PyObject { use bitcoin::Network::*; - let chain = PyModule::import(py, "hwilib.common") + let chain = PyModule::import_bound(py, "hwilib.common") .unwrap() .getattr("Chain") .unwrap();