Skip to content

Factor out pybind11/gil_simple.h #5614

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

Merged
merged 2 commits into from
Apr 14, 2025
Merged

Factor out pybind11/gil_simple.h #5614

merged 2 commits into from
Apr 14, 2025

Conversation

rwgk
Copy link
Collaborator

@rwgk rwgk commented Apr 13, 2025

Description

Long overdue, straightforward refactoring, eliminating code duplication in pybind11/detail/internals.h

Current motivation: Simplify PR #5564

Subtle API change (does NOT require any production code changes):

  • The disarm() member functions are removed from gil_scoped_acquire_simple and gil_scoped_release_simple.

This means, PYBIND11_SIMPLE_GIL_MANAGEMENT is no longer compatible with uses of disarm(). However, this is strictly an improvement, because the removed member functions were no-ops. — Note also that the disarm() functions are used only in very rare cases.


See also ChatGPT's take on using vs inheritance: https://chatgpt.com/share/67fc24a7-c4bc-8008-aa9b-b82c4909e0b4

Suggested changelog entry:

pybind11/gil_simple.h was factored out from pybind11/gil.h, so that it can easily be reused.

@rwgk rwgk marked this pull request as ready for review April 13, 2025 21:52
@rwgk rwgk requested a review from henryiii as a code owner April 13, 2025 21:52
@rwgk
Copy link
Collaborator Author

rwgk commented Apr 13, 2025

@b-pass Could you please review (and approve if it looks good to you)?

Copy link
Contributor

@b-pass b-pass left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@rwgk
Copy link
Collaborator Author

rwgk commented Apr 14, 2025

Thanks for the review!

@rwgk rwgk merged commit cbcc238 into pybind:master Apr 14, 2025
65 checks passed
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Apr 14, 2025
@rwgk rwgk deleted the gil_simple_h branch April 14, 2025 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs changelog Possibly needs a changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants