Initialize the Python script interpreter lazily (i.e. not at debugger startup)

This time it should also pass the gtests

llvm-svn: 266103
This commit is contained in:
Enrico Granata 2016-04-12 18:23:18 +00:00
parent b390d8ee39
commit 15d1b4e2aa
2 changed files with 5 additions and 4 deletions

View File

@ -274,7 +274,7 @@ ScriptInterpreterPython::ScriptInterpreterPython(CommandInterpreter &interpreter
m_lock_count(0),
m_command_thread_state(nullptr)
{
assert(g_initialized && "ScriptInterpreterPython created but InitializePrivate has not been called!");
InitializePrivate();
m_dictionary_name.append("_dict");
StreamString run_string;
@ -330,8 +330,6 @@ ScriptInterpreterPython::Initialize()
std::call_once(g_once_flag, []()
{
InitializePrivate();
PluginManager::RegisterPlugin(GetPluginNameStatic(),
GetPluginDescriptionStatic(),
lldb::eScriptLanguagePython,
@ -3097,7 +3095,9 @@ ScriptInterpreterPython::InitializeInterpreter (SWIGInitCallback swig_init_callb
void
ScriptInterpreterPython::InitializePrivate ()
{
assert(!g_initialized && "ScriptInterpreterPython::InitializePrivate() called more than once!");
if (g_initialized)
return;
g_initialized = true;
Timer scoped_timer (__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);

View File

@ -24,6 +24,7 @@ PythonTestSuite::SetUp()
// ScriptInterpreterPython::Initialize() depends on HostInfo being
// initializedso it can compute the python directory etc.
ScriptInterpreterPython::Initialize();
ScriptInterpreterPython::InitializePrivate();
// Although we don't care about concurrency for the purposes of running
// this test suite, Python requires the GIL to be locked even for