================ @@ -137,7 +137,16 @@ struct InitializePythonRAII { config.install_signal_handlers = 0; Py_InitializeFromConfig(&config); PyConfig_Clear(&config); - InitializeThreadsPrivate(); + + // The only case we should go further and acquire the GIL: it is unlocked. + if (PyGILState_Check()) + return; + + m_was_already_initialized = true; + m_gil_state = PyGILState_Ensure(); + LLDB_LOGV(GetLog(LLDBLog::Script), + "Ensured PyGILState. Previous state = {0}locked\n", + m_gil_state == PyGILState_UNLOCKED ? "un" : ""); ---------------- medismailben wrote:
nit: this is more readable. ```suggestion "Ensured PyGILState. Previous state = {0}\n", m_gil_state == PyGILState_UNLOCKED ? "unlocked" : "locked"); ``` https://github.com/llvm/llvm-project/pull/151780 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits