Use `_PyThreadState_UncheckedGet()` to check that the current thread is tracked by Python before checking whether it has the GIL. The latter will abort when the former is false.
Use `_PyThreadState_UncheckedGet()` to check that the current thread is tracked by Python before checking whether it has the GIL. The latter will abort when the former is false.