Merge pull request #1806 from pschafhalter/fix-memory-leak
Fix memory leak when calling Python from Rust
This commit is contained in:
commit
78b924db07
|
@ -28,6 +28,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||
- Loosened the lower bound on the `num-complex` optional dependency to support
|
||||
interop with `rust-numpy` and `ndarray` when building with the MSRV of 1.41
|
||||
[#1799](https://github.com/PyO3/pyo3/pull/1799)
|
||||
- Add missing `Py_DECREF` to `Python::run_code` which fixes a memory leak when
|
||||
calling Python from Rust. [#1806](https://github.com/PyO3/pyo3/pull/1806)
|
||||
|
||||
## [0.14.2] - 2021-08-09
|
||||
|
||||
|
|
|
@ -396,6 +396,7 @@ impl<'p> Python<'p> {
|
|||
return Err(PyErr::api_call_failed(self));
|
||||
}
|
||||
let res_ptr = ffi::PyEval_EvalCode(code_obj, globals, locals);
|
||||
ffi::Py_DECREF(code_obj);
|
||||
|
||||
self.from_owned_ptr_or_err(res_ptr)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue