[Lldb-commits] [lldb] r167810 - /lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp

Enrico Granata egranata at apple.com
Mon Nov 12 18:57:43 PST 2012


Author: enrico
Date: Mon Nov 12 20:57:43 2012
New Revision: 167810

URL: http://llvm.org/viewvc/llvm-project?rev=167810&view=rev
Log:
Giving at least some error information when a Python exception happens during command script import

Modified:
    lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp

Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=167810&r1=167809&r2=167810&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Mon Nov 12 20:57:43 2012
@@ -2483,7 +2483,17 @@
                 }
                 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





More information about the lldb-commits mailing list