pybind / pybind11

Seamless operability between C++11 and Python
https://pybind11.readthedocs.io/
Other
15.39k stars 2.07k forks source link

Provide `PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF` as an option #4753

Closed EthanSteinberg closed 1 year ago

EthanSteinberg commented 1 year ago

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.

rwgk commented 1 year ago

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

EthanSteinberg commented 1 year ago

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

EthanSteinberg commented 1 year ago

Looks like this is good: https://github.com/pytorch/pytorch/pull/105283

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