diff options
| author | Caroline Tice <ctice@apple.com> | 2011-03-07 23:24:28 +0000 |
|---|---|---|
| committer | Caroline Tice <ctice@apple.com> | 2011-03-07 23:24:28 +0000 |
| commit | 6258c53e12dbf973f64acbc055312f57564bc7d8 (patch) | |
| tree | 9c3f42a60811bbb642964bc6c793b84d46cb9f72 /lldb/source/Interpreter/ScriptInterpreterPython.cpp | |
| parent | 58d489fc6eea2ff51915e6a7589774ecd630b1a6 (diff) | |
| download | bcm5719-llvm-6258c53e12dbf973f64acbc055312f57564bc7d8.tar.gz bcm5719-llvm-6258c53e12dbf973f64acbc055312f57564bc7d8.zip | |
Add thread state initialization to the thread where the interactive
interpreter is run (which is separate from the thread where
Py_Initialize is called, where this normally gets set up).
llvm-svn: 127191
Diffstat (limited to 'lldb/source/Interpreter/ScriptInterpreterPython.cpp')
| -rw-r--r-- | lldb/source/Interpreter/ScriptInterpreterPython.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp index 54d46068905..68c120d451c 100644 --- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp +++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp @@ -1384,10 +1384,16 @@ ScriptInterpreterPython::RunEmbeddedPythonInterpreter (lldb::thread_arg_t baton) // The following call drops into the embedded interpreter loop and stays there until the // user chooses to exit from the Python interpreter. + Py_BEGIN_ALLOW_THREADS + PyGILState_STATE gstate = PyGILState_Ensure(); + run_string.Printf ("run_python_interpreter (%s)", script_interpreter->m_dictionary_name.c_str()); PyRun_SimpleString (run_string.GetData()); run_string.Clear (); + PyGILState_Release (gstate); + Py_END_ALLOW_THREADS + run_string.Printf ("run_one_line (%s, 'sys.stdin = save_stdin')", script_interpreter->m_dictionary_name.c_str()); PyRun_SimpleString (run_string.GetData()); run_string.Clear(); @@ -1474,6 +1480,7 @@ ScriptInterpreterPython::Initialize () ::setenv ("PYTHONPATH", pathon_path_env_cstr, 1); } + PyEval_InitThreads (); Py_Initialize (); PyObject *compiled_module = Py_CompileString (embedded_interpreter_string, |

