Skip to content

Commit

Permalink
Slightly rewording comment. (There were also other failures.)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralf W. Grosse-Kunstleve committed May 13, 2022
1 parent 2ad2285 commit e3ebb0d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions include/pybind11/pybind11.h
Original file line number Diff line number Diff line change
Expand Up @@ -2612,12 +2612,13 @@ void print(Args &&...args) {

error_already_set::~error_already_set() {
// Not using py::gil_scoped_acquire here since that calls get_internals,
// which triggers tensorflow failures (a full explanation is currently unknown).
// which is known to trigger failures in the wild (a full explanation is
// currently unknown).
// gil_scoped_acquire_local here is a straight copy from get_internals code.
// I.e. py::gil_scoped_acquire acquires the GIL in detail/internals.h exactly
// like we do here now, releases it, then acquires it again in gil.h.
// Using gil_scoped_acquire_local cuts out the get_internals overhead and
// fixes the tensorflow failures.
// fixes the failures observed in the wild. See PR #1895 for more background.
struct gil_scoped_acquire_local {
gil_scoped_acquire_local() : state(PyGILState_Ensure()) {}
~gil_scoped_acquire_local() { PyGILState_Release(state); }
Expand Down

0 comments on commit e3ebb0d

Please sign in to comment.