Fix some python shutdown / ordering issues.

Differential Revision: http://reviews.llvm.org/D4826

Reviewed by: Enrico Granata

llvm-svn: 215256
This commit is contained in:
Zachary Turner
2014-08-08 23:20:25 +00:00
parent 25d93099dd
commit e96838e304
4 changed files with 21 additions and 15 deletions

View File

@@ -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