diff options
| author | Johnny Chen <johnny.chen@apple.com> | 2012-05-04 20:37:11 +0000 |
|---|---|---|
| committer | Johnny Chen <johnny.chen@apple.com> | 2012-05-04 20:37:11 +0000 |
| commit | 30e422d7ba5cd186135b7d743b1a24e30c698081 (patch) | |
| tree | 6a0f5fa66820beb21c66e555f6539722a84be87b /lldb/source/Interpreter/ScriptInterpreterPython.cpp | |
| parent | c2009779052a62a0cfef6e118adb6a55bb29b2db (diff) | |
| download | bcm5719-llvm-30e422d7ba5cd186135b7d743b1a24e30c698081.tar.gz bcm5719-llvm-30e422d7ba5cd186135b7d743b1a24e30c698081.zip | |
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
Diffstat (limited to 'lldb/source/Interpreter/ScriptInterpreterPython.cpp')
| -rw-r--r-- | lldb/source/Interpreter/ScriptInterpreterPython.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
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); |

