diff options
author | Enrico Granata <egranata@apple.com> | 2013-05-30 18:56:47 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2013-05-30 18:56:47 +0000 |
commit | 0f6a057147d943bfec37364a800290505be1bf78 (patch) | |
tree | 551de7154c15552d8e0fa91f0a3f981794c1a70c /lldb/scripts/Python/python-wrapper.swig | |
parent | ef7ea33178674faaf89fb00720b505a6dc2eaeb4 (diff) | |
download | bcm5719-llvm-0f6a057147d943bfec37364a800290505be1bf78.tar.gz bcm5719-llvm-0f6a057147d943bfec37364a800290505be1bf78.zip |
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
Diffstat (limited to 'lldb/scripts/Python/python-wrapper.swig')
-rw-r--r-- | lldb/scripts/Python/python-wrapper.swig | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lldb/scripts/Python/python-wrapper.swig b/lldb/scripts/Python/python-wrapper.swig index 789cf6fae11..4723a9cce89 100644 --- a/lldb/scripts/Python/python-wrapper.swig +++ b/lldb/scripts/Python/python-wrapper.swig @@ -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); } |