[Lldb-commits] [lldb] r156200 - /lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp

Johnny Chen johnny.chen at apple.com
Fri May 4 13:37:11 PDT 2012


Author: johnny
Date: Fri May  4 15:37:11 2012
New Revision: 156200

URL: http://llvm.org/viewvc/llvm-project?rev=156200&view=rev
Log:
When the current thread state is NULL, PyThreadState_Get() issues a fatal error.
Use a gentler API PyThreadState_GetDict(), instead.

rdar://problem/11292882

Modified:
    lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp

Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=156200&r1=156199&r2=156200&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Fri May  4 15:37:11 2012
@@ -386,7 +386,10 @@
     // 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);





More information about the lldb-commits mailing list