diff options
author | Zachary Turner <zturner@google.com> | 2014-08-08 23:20:25 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2014-08-08 23:20:25 +0000 |
commit | e96838e3044b5b6034def3a859775d36a1e31867 (patch) | |
tree | 753bc4e9e233feab97625b7e1ffb07c4416fef6b /lldb/source/Interpreter/ScriptInterpreterPython.cpp | |
parent | 25d93099dda408e899f231dac0ba984884e84070 (diff) | |
download | bcm5719-llvm-e96838e3044b5b6034def3a859775d36a1e31867.tar.gz bcm5719-llvm-e96838e3044b5b6034def3a859775d36a1e31867.zip |
Fix some python shutdown / ordering issues.
Differential Revision: http://reviews.llvm.org/D4826
Reviewed by: Enrico Granata
llvm-svn: 215256
Diffstat (limited to 'lldb/source/Interpreter/ScriptInterpreterPython.cpp')
-rw-r--r-- | lldb/source/Interpreter/ScriptInterpreterPython.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp index ec541b14a90..598bab3f8fd 100644 --- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp +++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp @@ -1806,7 +1806,11 @@ ScriptInterpreterPython::Clear () Locker locker(this, ScriptInterpreterPython::Locker::AcquireLock, ScriptInterpreterPython::Locker::FreeAcquiredLock); - PyRun_SimpleString("lldb.debugger = None; lldb.target = None; lldb.process = None; lldb.thread = None; lldb.frame = None"); + + // This may be called as part of Py_Finalize. In that case the modules are destroyed in random + // order and we can't guarantee that we can access these. + if (Py_IsInitialized()) + PyRun_SimpleString("lldb.debugger = None; lldb.target = None; lldb.process = None; lldb.thread = None; lldb.frame = None"); } bool |