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

Stop leaking in new_closure #2842

Merged
merged 1 commit into from
Dec 28, 2022
Merged

Stop leaking in new_closure #2842

merged 1 commit into from
Dec 28, 2022

Conversation

davidhewitt
Copy link
Member

@davidhewitt davidhewitt commented Dec 27, 2022

This is a rebase of #2690 which simplifies the MaybeLeaked abstraction from that PR with just Cow<'static, CStr>.

This enabled me to annotate with FIXME all the places where we still leak; I wonder if we could potentially use GILOnceCell in future and statics to avoid those. As those callsities are in #[pyclass] and #[pyfunction] these are effectively in statics anyway, but it would be nice to tidy up.

src/impl_/pymethods.rs Outdated Show resolved Hide resolved
Copy link
Member

@adamreichold adamreichold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for the question of whether we need to outer Option layer, this looks good to me.

I still wonder whether we should dog-food our own capsule API, but maybe this is best left as a separate PR?

Copy link
Member Author

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now using our PyCapsule::new 😄

src/err/mod.rs Show resolved Hide resolved
src/types/function.rs Outdated Show resolved Hide resolved
src/types/function.rs Outdated Show resolved Hide resolved
@davidhewitt
Copy link
Member Author

bors r=adamreichold

@bors
Copy link
Contributor

bors bot commented Dec 28, 2022

Build succeeded:

@bors bors bot merged commit c2adf14 into PyO3:main Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants