Skip to content

Commit daa5af2

Browse files
authored
Fix memory leak in Python (valkey-io#2816)
* converted refrences to bound Signed-off-by: lior sventitzky <[email protected]>
1 parent 68c56e7 commit daa5af2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

python/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl Script {
8484
fn new(code: &Bound<PyAny>) -> PyResult<Self> {
8585
let hash = if let Ok(code_str) = code.extract::<String>() {
8686
glide_core::scripts_container::add_script(code_str.as_bytes())
87-
} else if let Ok(code_bytes) = code.extract::<&PyBytes>() {
87+
} else if let Ok(code_bytes) = code.extract::<Bound<PyBytes>>() {
8888
glide_core::scripts_container::add_script(code_bytes.as_bytes())
8989
} else {
9090
return Err(PyTypeError::new_err(
@@ -267,7 +267,7 @@ fn glide(_py: Python, m: &Bound<PyModule>) -> PyResult<()> {
267267
}
268268

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

0 commit comments

Comments
 (0)