[lldb] Eliminate PyGILState_Check (NFC) (#152006)
Eliminate calls to PyGILState_Check, which is not part of the Python Limited C API. In the Locker, we can use PyGILState_Ensure directly. We could do something similar to replace the assert, but I don't think it's worth it. We don't assert that we hold the GIL anywhere else.
This commit is contained in:
1 parent
9d151897ba
commit
ad623a813e
2 files changed
+3
-3
No files matched your search
@@ -139,11 +139,12 @@ public:
|
||||
PyConfig_Clear(&config);
|
||||
|
||||
// The only case we should go further and acquire the GIL: it is unlocked.
|
||||
if (PyGILState_Check())
|
||||
PyGILState_STATE gil_state = PyGILState_Ensure();
|
||||
if (gil_state != PyGILState_UNLOCKED)
|
||||
return;
|
||||
|
||||
m_was_already_initialized = true;
|
||||
m_gil_state = PyGILState_Ensure();
|
||||
m_gil_state = gil_state;
|
||||
LLDB_LOGV(GetLog(LLDBLog::Script),
|
||||
"Ensured PyGILState. Previous state = {0}",
|
||||
m_gil_state == PyGILState_UNLOCKED ? "unlocked" : "locked");
|
||||
|
||||
Reference in new issue
Block a user