const GIL_COUNT: LocalKey<Cell<isize>>;
Expand description
This is an internal counter in pyo3 monitoring whether this thread has the GIL.
It will be incremented whenever a GILGuard or GILPool is created, and decremented whenever they are dropped.
As a result, if this thread has the GIL, GIL_COUNT is greater than zero.
Additionally, we sometimes need to prevent safe access to the GIL,
e.g. when implementing __traverse__
, which is represented by a negative value.