From 283d00d31a7c67259db3e5898de8674646069c5e Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Sun, 5 Mar 2023 06:24:07 +0100 Subject: [PATCH] Fix(Rust) - Fix of a silly GIL mistake --- src/io.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/io.rs b/src/io.rs index 6c06e85..2fa3915 100644 --- a/src/io.rs +++ b/src/io.rs @@ -275,7 +275,7 @@ use crate::{solve_craft, Recipe, Stats}; /// ``` #[cfg(not(feature = "no_python"))] #[pyfunction] -pub fn solve_from_python(values: &PyAny) -> PyResult>> { +pub fn solve_from_python(py: Python<'_>, values: &PyAny) -> PyResult>> { // Create Recipe let recipe = Recipe { durability: values.getattr("durability")?.extract()?, @@ -304,8 +304,10 @@ pub fn solve_from_python(values: &PyAny) -> PyResult>> }; // println!("{:?} len: {:?} ",values,values.getattr("len()")); - let res = solve_craft(recipe, stats, param); - Ok(res) + py.allow_threads(move || { + let res = solve_craft(recipe, stats, param); + Ok(res) + }) } #[cfg(test)]