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

Py_CompileString decref #1810

Merged
merged 5 commits into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from 4 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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +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)
- Add missing `Py_DECREF` to `Python::run_code` and `PyModule::from_code` which fixes a memory leak when
calling Python from Rust. [#1806](https://github.com/PyO3/pyo3/pull/1806), [#1810](https://github.com/PyO3/pyo3/pull/1810)

## [0.14.2] - 2021-08-09

Expand Down
2 changes: 2 additions & 0 deletions src/types/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ impl PyModule {

let mptr = ffi::PyImport_ExecCodeModuleEx(module.as_ptr(), cptr, filename.as_ptr());
if mptr.is_null() {
ffi::Py_DECREF(cptr);
return Err(PyErr::api_call_failed(py));
messense marked this conversation as resolved.
Show resolved Hide resolved
}

ffi::Py_DECREF(cptr);
Ptrskay3 marked this conversation as resolved.
Show resolved Hide resolved
<&PyModule as crate::FromPyObject>::extract(py.from_owned_ptr_or_err(mptr)?)
}
}
Expand Down