From daa5af2f6f1f3ebc55dce2c7e461cf4a954d6ec4 Mon Sep 17 00:00:00 2001 From: Lior Sventitzky Date: Sun, 15 Dec 2024 18:56:18 +0200 Subject: [PATCH] Fix memory leak in Python (#2816) * converted refrences to bound Signed-off-by: lior sventitzky --- python/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/src/lib.rs b/python/src/lib.rs index e3b9a298cb..09914c2c59 100644 --- a/python/src/lib.rs +++ b/python/src/lib.rs @@ -84,7 +84,7 @@ impl Script { fn new(code: &Bound) -> PyResult { let hash = if let Ok(code_str) = code.extract::() { glide_core::scripts_container::add_script(code_str.as_bytes()) - } else if let Ok(code_bytes) = code.extract::<&PyBytes>() { + } else if let Ok(code_bytes) = code.extract::>() { glide_core::scripts_container::add_script(code_bytes.as_bytes()) } else { return Err(PyTypeError::new_err( @@ -267,7 +267,7 @@ fn glide(_py: Python, m: &Bound) -> PyResult<()> { } #[pyfunction] - pub fn create_leaked_bytes_vec(args_vec: Vec<&PyBytes>) -> usize { + pub fn create_leaked_bytes_vec(args_vec: Vec>) -> usize { // Convert the bytes vec -> Bytes vector let bytes_vec: Vec = args_vec .iter()