Skip to content

fix: release the filename reference in def_submodule - #6238

Open
kroplabeskidu wants to merge 1 commit into
pybind:masterfrom
kroplabeskidu:fix-def-submodule-file-leak
Open

kroplabeskidu wants to merge 1 commit into
pybind:masterfrom
kroplabeskidu:fix-def-submodule-file-leak

Conversation

@kroplabeskidu

Copy link
Copy Markdown

Description

Item 25 from #6159. PyModule_GetFilenameObject returns a new reference, but def_submodule stored it in a handle and never released it, so each call leaked one reference to the parent's __file__. Without the fix, the new test's refcount goes from 4 to 14 after 10 calls.

The reference is now held in an object.

Suggested changelog entry:

  • Fixed a reference leak of the parent module's __file__ in module_::def_submodule.

This branch has not been deployed

No deployments
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.

1 participant