summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/ScriptInterpreterPython.cpp
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2012-11-13 02:57:43 +0000
committerEnrico Granata <egranata@apple.com>2012-11-13 02:57:43 +0000
commit5ce1d01887c3a49f158eb6466b191bcf68781aea (patch)
tree749e398856f5d5cc8b1a9c1611155018832d45d9 /lldb/source/Interpreter/ScriptInterpreterPython.cpp
parent66dbd3fbcc05534b53dd756041812a619243a961 (diff)
downloadbcm5719-llvm-5ce1d01887c3a49f158eb6466b191bcf68781aea.tar.gz
bcm5719-llvm-5ce1d01887c3a49f158eb6466b191bcf68781aea.zip
Giving at least some error information when a Python exception happens during command script import
llvm-svn: 167810
Diffstat (limited to 'lldb/source/Interpreter/ScriptInterpreterPython.cpp')
-rw-r--r--lldb/source/Interpreter/ScriptInterpreterPython.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
index 11a64b6f6cd..638720e93a5 100644
--- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
@@ -2483,7 +2483,17 @@ ScriptInterpreterPython::LoadScriptingModule (const char* pathname,
}
else // any other error
{
- error.SetErrorString("Python raised an error while importing module");
+ PyObject *type,*value,*traceback;
+ PyErr_Fetch (&type,&value,&traceback);
+
+ if (value && value != Py_None)
+ error.SetErrorStringWithFormat("Python error raised while importing module: %s", PyString_AsString(PyObject_Str(value)));
+ else
+ error.SetErrorString("Python raised an error while importing module");
+
+ Py_XDECREF(type);
+ Py_XDECREF(value);
+ Py_XDECREF(traceback);
}
}
else // we failed but have no error to explain why
OpenPOWER on IntegriCloud