#include //Use this class in a c++ funktion that called into python : c++ => python PyLockGIL::PyLockGIL() : m_gstate(PyGILState_Ensure()) { } PyLockGIL::~PyLockGIL() { PyGILState_Release(m_gstate); }