Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory leak in Python #2816

Merged
merged 2 commits into from
Dec 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading