| 268 | } |
| 269 | |
| 270 | inline subinterpreter_scoped_activate::~subinterpreter_scoped_activate() { |
| 271 | if (simple_gil_) { |
| 272 | // We were on this interpreter already, so just make sure the GIL goes back as it was |
| 273 | PyGILState_Release(gil_state_); |
| 274 | } else { |
| 275 | if (tstate_) { |
| 276 | #if defined(PYBIND11_DETAILED_ERROR_MESSAGES) |
| 277 | if (detail::get_thread_state_unchecked() != tstate_) { |
| 278 | pybind11_fail("~subinterpreter_scoped_activate: thread state must be current!"); |
| 279 | } |
| 280 | #endif |
| 281 | detail::get_internals().tstate.reset(); |
| 282 | PyThreadState_Clear(tstate_); |
| 283 | PyThreadState_DeleteCurrent(); |
| 284 | } |
| 285 | |
| 286 | // Go back the previous interpreter (if any) and acquire THAT gil |
| 287 | PyThreadState_Swap(old_tstate_); |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE) |
nothing calls this directly
no test coverage detected