diff options
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp')
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp | 48 |
1 files changed, 15 insertions, 33 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index 9ae631717af..8729a7353e9 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -7,12 +7,6 @@ // //===----------------------------------------------------------------------===// -#ifdef LLDB_DISABLE_PYTHON - -// Python is disabled in this build - -#else - // LLDB Python header must be included first #include "lldb-python.h" @@ -3191,30 +3185,18 @@ void ScriptInterpreterPython::AddToSysPath(AddLocation location, PyRun_SimpleString(statement.c_str()); } -// void -// ScriptInterpreterPython::Terminate () -//{ -// // We are intentionally NOT calling Py_Finalize here (this would be the -// logical place to call it). Calling -// // Py_Finalize here causes test suite runs to seg fault: The test suite -// runs in Python. It registers -// // SBDebugger::Terminate to be called 'at_exit'. When the test suite -// Python harness finishes up, it calls -// // Py_Finalize, which calls all the 'at_exit' registered functions. -// SBDebugger::Terminate calls Debugger::Terminate, -// // which calls lldb::Terminate, which calls ScriptInterpreter::Terminate, -// which calls -// // ScriptInterpreterPython::Terminate. So if we call Py_Finalize here, we -// end up with Py_Finalize being called from -// // within Py_Finalize, which results in a seg fault. -// // -// // Since this function only gets called when lldb is shutting down and -// going away anyway, the fact that we don't -// // actually call Py_Finalize should not cause any problems (everything -// should shut down/go away anyway when the -// // process exits). -// // -//// Py_Finalize (); -//} - -#endif // #ifdef LLDB_DISABLE_PYTHON +// We are intentionally NOT calling Py_Finalize here (this would be the logical +// place to call it). Calling Py_Finalize here causes test suite runs to seg +// fault: The test suite runs in Python. It registers SBDebugger::Terminate to +// be called 'at_exit'. When the test suite Python harness finishes up, it +// calls Py_Finalize, which calls all the 'at_exit' registered functions. +// SBDebugger::Terminate calls Debugger::Terminate, which calls lldb::Terminate, +// which calls ScriptInterpreter::Terminate, which calls +// ScriptInterpreterPython::Terminate. So if we call Py_Finalize here, we end +// up with Py_Finalize being called from within Py_Finalize, which results in a +// seg fault. Since this function only gets called when lldb is shutting down +// and going away anyway, the fact that we don't actually call Py_Finalize +// should not cause any problems (everything should shut down/go away anyway +// when the process exits). +// +// void ScriptInterpreterPython::Terminate() { Py_Finalize (); } |