From d7d49b0c42f8b8b472c47f136eaa64e3dc34e143 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Sun, 13 Oct 2024 16:51:23 +0200 Subject: [PATCH] Fix deprecated PyO3 functions --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 2e892c2..6a9c8a0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -199,11 +199,11 @@ impl From for ExceptionCodePy { #[allow(non_snake_case)] fn raise_MemoryException(message: String, e: MemError) -> PyErr { Python::with_gil(|py| { - let icicle = py.import("icicle").unwrap(); + let icicle = py.import_bound("icicle").unwrap(); let exception = icicle.getattr("MemoryException").unwrap(); let args = (message, MemoryExceptionCode::from(e)); let inst = exception.call1(args).unwrap(); - PyErr::from_value(inst) + PyErr::from_value_bound(inst) }) } @@ -508,7 +508,7 @@ fn architectures() -> PyResult> { /// the `lib.name` setting in the `Cargo.toml`, else Python will not be able to /// import the module. #[pymodule] -fn icicle(_: Python<'_>, m: &PyModule) -> PyResult<()> { +fn icicle(m: &Bound<'_, PyModule>) -> PyResult<()> { m.add_function(wrap_pyfunction!(architectures, m)?)?; m.add_class::()?; m.add_class::()?;