This checkin enables Python summaries to return any string-convertible object
Upon encountering an object not of type string, LLDB will get the string representation of it (akin to calling str(X) in Python code) and use that as the summary to display Feedback is welcome as to whether repr() should be used instead (but the argument for repr() better be highly persuasive :-) llvm-svn: 182953
This commit is contained in:
parent
ef7ea33178
commit
0f6a057147
|
@ -318,8 +318,18 @@ LLDBSwigPythonCallTypeScript
|
|||
pvalue = PyObject_CallObject (pfunc, pargs);
|
||||
Py_DECREF (pargs);
|
||||
|
||||
if (pvalue != NULL && pvalue != Py_None && PyString_Check(pvalue))
|
||||
retval.assign(PyString_AsString(pvalue));
|
||||
if (pvalue != NULL && pvalue != Py_None)
|
||||
{
|
||||
if (PyString_Check(pvalue))
|
||||
retval.assign(PyString_AsString(pvalue));
|
||||
else
|
||||
{
|
||||
PyObject* value_as_string = PyObject_Str(pvalue);
|
||||
if (value_as_string && value_as_string != Py_None && PyString_Check(value_as_string))
|
||||
retval.assign(PyString_AsString(value_as_string));
|
||||
Py_XDECREF(value_as_string);
|
||||
}
|
||||
}
|
||||
Py_XDECREF (pvalue);
|
||||
Py_INCREF (session_dict);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue