Skip to content

Commit

Permalink
Fix memory leak in Python (valkey-io#2816)
Browse files Browse the repository at this point in the history
* converted refrences to bound

Signed-off-by: lior sventitzky <liorsve@amazon.com>
  • Loading branch information
liorsve authored Dec 15, 2024
1 parent 68c56e7 commit daa5af2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl Script {
fn new(code: &Bound<PyAny>) -> PyResult<Self> {
let hash = if let Ok(code_str) = code.extract::<String>() {
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::<Bound<PyBytes>>() {
glide_core::scripts_container::add_script(code_bytes.as_bytes())
} else {
return Err(PyTypeError::new_err(
Expand Down Expand Up @@ -267,7 +267,7 @@ fn glide(_py: Python, m: &Bound<PyModule>) -> PyResult<()> {
}

#[pyfunction]
pub fn create_leaked_bytes_vec(args_vec: Vec<&PyBytes>) -> usize {
pub fn create_leaked_bytes_vec(args_vec: Vec<Bound<PyBytes>>) -> usize {
// Convert the bytes vec -> Bytes vector
let bytes_vec: Vec<Bytes> = args_vec
.iter()
Expand Down

0 comments on commit daa5af2

Please sign in to comment.