Skip to content

Provide PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF as an option - #4753

Merged
rwgk merged 12 commits into
pybind:masterfrom
EthanSteinberg:patch-1
Jul 17, 2023
Merged

Provide PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF as an option#4753
rwgk merged 12 commits into
pybind:masterfrom
EthanSteinberg:patch-1

Conversation

@EthanSteinberg

@EthanSteinbergEthanSteinberg commented Jul 16, 2023

Copy link
Copy Markdown
Collaborator

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
@EthanSteinbergEthanSteinberg changed the title Remove GIL checksAdd #define PYBIND11_NO_GIL_CHECKS to disable GIL checksJul 16, 2023
@EthanSteinberg
EthanSteinberg requested a review from rwgkJuly 16, 2023 13:27
@EthanSteinberg
EthanSteinberg marked this pull request as ready for review July 16, 2023 13:27
Comment threadinclude/pybind11/detail/common.h Outdated
Comment threadinclude/pybind11/pytypes.h Outdated
@rwgkrwgk changed the title Add #define PYBIND11_NO_GIL_CHECKS to disable GIL checksProvide PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF as an optionJul 16, 2023
@rwgk

rwgk commented Jul 16, 2023

Copy link
Copy Markdown
Collaborator

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

Comment threadinclude/pybind11/detail/common.h Outdated
@EthanSteinberg

Copy link
Copy Markdown
CollaboratorAuthor

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

@EthanSteinberg

EthanSteinberg commented Jul 16, 2023

Copy link
Copy Markdown
CollaboratorAuthor

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:masterJul 17, 2023
@github-actionsgithub-actionsBot 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 added a commit to rwgk/pybind11 that referenced this pull request Jul 17, 2023
@rwgkrwgk 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 added 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 <slepov@gmail.com>
Co-authored-by: Ethan Steinberg <ethan.steinberg@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for freeto 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

@EthanSteinberg@rwgk