summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/ScriptInterpreterPython.cpp
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2012-07-31 16:58:12 +0000
committerEnrico Granata <egranata@apple.com>2012-07-31 16:58:12 +0000
commit008eaf8460f9c0dc3b02a1eff161825678a110a3 (patch)
treefcd0516860cc12c00fd514d307d6e41f7dfe91a3 /lldb/source/Interpreter/ScriptInterpreterPython.cpp
parent6b12f596efe9234fa3be6523e910d44d1e0cd37b (diff)
downloadbcm5719-llvm-008eaf8460f9c0dc3b02a1eff161825678a110a3.tar.gz
bcm5719-llvm-008eaf8460f9c0dc3b02a1eff161825678a110a3.zip
<rdar://problem/11862570> Fixing a potential crasher related to Python locking
llvm-svn: 161054
Diffstat (limited to 'lldb/source/Interpreter/ScriptInterpreterPython.cpp')
-rw-r--r--lldb/source/Interpreter/ScriptInterpreterPython.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
index e1aa378f138..51f4af7e837 100644
--- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
@@ -367,7 +367,7 @@ ScriptInterpreterPython::PythonInputReaderManager::InputReaderCallback
StreamString run_string;
char error_str[1024];
const char *pty_slave_name = script_interpreter->m_embedded_python_pty.GetSlaveName (error_str, sizeof (error_str));
- if (pty_slave_name != NULL)
+ if (pty_slave_name != NULL && PyThreadState_GetDict() != NULL)
{
run_string.Printf ("run_one_line (%s, 'save_stderr = sys.stderr')", script_interpreter->m_dictionary_name.c_str());
PyRun_SimpleString (run_string.GetData());
@@ -474,7 +474,7 @@ ScriptInterpreterPython::PythonInputReaderManager::InputReaderCallback
StreamString run_string;
char error_str[1024];
const char *pty_slave_name = script_interpreter->m_embedded_python_pty.GetSlaveName (error_str, sizeof (error_str));
- if (pty_slave_name != NULL)
+ if (pty_slave_name != NULL && PyThreadState_GetDict() != NULL)
{
run_string.Printf ("run_one_line (%s, 'sys.stdin = save_stdin')", script_interpreter->m_dictionary_name.c_str());
PyRun_SimpleString (run_string.GetData());
OpenPOWER on IntegriCloud