From a4d21eda4c2b80dac4f48d3ce7f59c711b7d0265 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Wed, 13 Aug 2025 11:23:59 -0700 Subject: [PATCH] [lldb] Use PyThread_get_thread_ident instead of accessing PyThreadState Use `PyThread_get_thread_ident`, which is part of the Stable API, instead of accessing a member of the PyThreadState, which is opaque when using the Stable API. --- .../ScriptInterpreter/Python/ScriptInterpreterPython.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index 5b97fcb5acf58..15ea5e995af5c 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -909,11 +909,11 @@ bool ScriptInterpreterPythonImpl::Interrupt() { Log *log = GetLog(LLDBLog::Script); if (IsExecutingPython()) { - PyThreadState *state = PyThreadState_GET(); + PyThreadState *state = PyThreadState_Get(); if (!state) state = GetThreadState(); if (state) { - long tid = state->thread_id; + long tid = PyThread_get_thread_ident(); PyThreadState_Swap(state); int num_threads = PyThreadState_SetAsyncExc(tid, PyExc_KeyboardInterrupt); LLDB_LOGF(log,