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

Provide PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF as an option #4753

Merged
merged 12 commits into from
Jul 17, 2023

Conversation

EthanSteinberg
Copy link
Collaborator

@EthanSteinberg EthanSteinberg commented Jul 16, 2023

Pybind11 recently added a feature to help detect GIL errors during inc_ref and dec_ref. As far as we can tell, theses checks do work correctly in cpython, but some projects want to disable these as a temporary measure while they debug further.

This flag will allow temporary disabling of these checks.

@EthanSteinberg EthanSteinberg marked this pull request as draft July 16, 2023 01:58
@EthanSteinberg EthanSteinberg changed the title Remove GIL checks Add #define PYBIND11_NO_GIL_CHECKS to disable GIL checks Jul 16, 2023
@EthanSteinberg EthanSteinberg requested a review from rwgk July 16, 2023 13:27
@EthanSteinberg EthanSteinberg marked this pull request as ready for review July 16, 2023 13:27
include/pybind11/detail/common.h Outdated Show resolved Hide resolved
include/pybind11/pytypes.h Outdated Show resolved Hide resolved
@rwgk rwgk changed the title Add #define PYBIND11_NO_GIL_CHECKS to disable GIL checks Provide PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF as an option Jul 16, 2023
@rwgk
Copy link
Collaborator

rwgk commented Jul 16, 2023

I went ahead and changed the title of this PR, so it doesn't accidentally get merged with the other name for the define.

include/pybind11/detail/common.h Outdated Show resolved Hide resolved
@EthanSteinberg
Copy link
Collaborator Author

Ok. I'm going to test this end-to-end, and if it works, I will merge it.

@EthanSteinberg
Copy link
Collaborator Author

EthanSteinberg commented Jul 16, 2023

Looks like this is good: pytorch/pytorch#105283

@rwgk Can you merge this in when you get a chance?

@rwgk rwgk merged commit 99131a8 into pybind:master Jul 17, 2023
78 of 80 checks passed
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Jul 17, 2023
rwgk pushed a commit to rwgk/pybind11 that referenced this pull request Jul 17, 2023
…ind#4753)

* Remove GIL checks

* Update common.h

* Add flag

* style: pre-commit fixes

* Update pytypes.h

* style: pre-commit fixes

* Update common.h

* style: pre-commit fixes

* Update pytypes.h

* style: pre-commit fixes

* Update common.h

* style: pre-commit fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
rwgk pushed a commit to rwgk/pybind11 that referenced this pull request Jul 17, 2023
@rwgk rwgk removed the needs changelog Possibly needs a changelog entry label Jul 17, 2023
@EthanSteinberg EthanSteinberg deleted the patch-1 branch July 17, 2023 11:36
rwgk pushed a commit that referenced this pull request Jul 17, 2023
* Update README.rst - Add missing comma in the list of acknowlegements (#4750)

* Disable `PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF` generally for PyPy (not just PyPy Windows). (#4751)

* Update changelog

* Provide `PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF` as an option (#4753)

* Remove GIL checks

* Update common.h

* Add flag

* style: pre-commit fixes

* Update pytypes.h

* style: pre-commit fixes

* Update common.h

* style: pre-commit fixes

* Update pytypes.h

* style: pre-commit fixes

* Update common.h

* style: pre-commit fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Update changelog: PR #4753

---------

Co-authored-by: bzaar <[email protected]>
Co-authored-by: Ethan Steinberg <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.

2 participants