From 30e422d7ba5cd186135b7d743b1a24e30c698081 Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Fri, 4 May 2012 20:37:11 +0000 Subject: When the current thread state is NULL, PyThreadState_Get() issues a fatal error. Use a gentler API PyThreadState_GetDict(), instead. rdar://problem/11292882 llvm-svn: 156200 --- lldb/source/Interpreter/ScriptInterpreterPython.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lldb/source/Interpreter/ScriptInterpreterPython.cpp') diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp index 9272b7e8f7d..89e5cb3cbd2 100644 --- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp +++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp @@ -386,7 +386,10 @@ ScriptInterpreterPython::LeaveSession () // in some (rare) cases during cleanup Python may end up believing we have no thread state // and PyImport_AddModule will crash if that is the case - since that seems to only happen // when destroying the SBDebugger, we can make do without clearing up stdout and stderr - if (PyThreadState_Get()) + + // rdar://problem/11292882 + // When the current thread state is NULL, PyThreadState_Get() issues a fatal error. + if (PyThreadState_GetDict()) { PyObject *sysmod = PyImport_AddModule ("sys"); PyObject *sysdict = PyModule_GetDict (sysmod); -- cgit v1.2.3