From 9fad90257eedb7f7a0d4e084f72f1618db5d10db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= <1771332+vlaci@users.noreply.github.com> Date: Mon, 10 Feb 2025 16:40:50 +0100 Subject: [PATCH] fix(rust): follow-up API changes in PyO3 0.23 https://pyo3.rs/v0.23.4/migration.html#from-022-to-023 --- rust/src/math_tools.rs | 4 ++-- rust/src/sandbox/mod.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rust/src/math_tools.rs b/rust/src/math_tools.rs index c3e5ae4c89..690d9579f7 100644 --- a/rust/src/math_tools.rs +++ b/rust/src/math_tools.rs @@ -64,7 +64,7 @@ pub fn py_chi_square_probability(py: Python, data: &[u8]) -> PyResult { } pub fn init_module(root_module: &Bound<'_, PyModule>) -> PyResult<()> { - let module = PyModule::new_bound(root_module.py(), "math_tools")?; + let module = PyModule::new(root_module.py(), "math_tools")?; module.add_function(wrap_pyfunction!(py_shannon_entropy, &module)?)?; module.add_function(wrap_pyfunction!(py_chi_square_probability, &module)?)?; @@ -72,7 +72,7 @@ pub fn init_module(root_module: &Bound<'_, PyModule>) -> PyResult<()> { root_module .py() - .import_bound("sys")? + .import("sys")? .getattr("modules")? .set_item("unblob._rust.math", module)?; diff --git a/rust/src/sandbox/mod.rs b/rust/src/sandbox/mod.rs index 439d6752c6..15877382e2 100644 --- a/rust/src/sandbox/mod.rs +++ b/rust/src/sandbox/mod.rs @@ -107,18 +107,18 @@ impl PyAccessFS { } pub fn init_module(root_module: &Bound<'_, PyModule>) -> PyResult<()> { - let module = PyModule::new_bound(root_module.py(), "sandbox")?; + let module = PyModule::new(root_module.py(), "sandbox")?; module.add_function(wrap_pyfunction!(py_restrict_access, &module)?)?; module.add_class::()?; module.add( "SandboxError", - root_module.py().get_type_bound::(), + root_module.py().get_type::(), )?; root_module.add_submodule(&module)?; root_module .py() - .import_bound("sys")? + .import("sys")? .getattr("modules")? .set_item("unblob._rust.sandbox", module)?;