Use gdbpy_ref in call_doc_function
This changes call_doc_function to use gdbpy_ref. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-param.c (call_doc_function): Use gdbpy_ref.
This commit is contained in:
parent
87ce03fdc5
commit
1bb44c9f56
2 changed files with 9 additions and 6 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2017-01-10 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* python/py-param.c (call_doc_function): Use gdbpy_ref.
|
||||||
|
|
||||||
2017-01-10 Tom Tromey <tom@tromey.com>
|
2017-01-10 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* python/py-linetable.c (build_line_table_tuple_from_pcs)
|
* python/py-linetable.c (build_line_table_tuple_from_pcs)
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "completer.h"
|
#include "completer.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include "arch-utils.h"
|
#include "arch-utils.h"
|
||||||
|
#include "py-ref.h"
|
||||||
|
|
||||||
/* Parameter constants and their values. */
|
/* Parameter constants and their values. */
|
||||||
struct parm_constant
|
struct parm_constant
|
||||||
|
@ -329,15 +330,14 @@ static gdb::unique_xmalloc_ptr<char>
|
||||||
call_doc_function (PyObject *obj, PyObject *method, PyObject *arg)
|
call_doc_function (PyObject *obj, PyObject *method, PyObject *arg)
|
||||||
{
|
{
|
||||||
gdb::unique_xmalloc_ptr<char> data;
|
gdb::unique_xmalloc_ptr<char> data;
|
||||||
PyObject *result = PyObject_CallMethodObjArgs (obj, method, arg, NULL);
|
gdbpy_ref result (PyObject_CallMethodObjArgs (obj, method, arg, NULL));
|
||||||
|
|
||||||
if (! result)
|
if (result == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (gdbpy_is_string (result))
|
if (gdbpy_is_string (result.get ()))
|
||||||
{
|
{
|
||||||
data = python_string_to_host_string (result);
|
data = python_string_to_host_string (result.get ());
|
||||||
Py_DECREF (result);
|
|
||||||
if (! data)
|
if (! data)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -345,7 +345,6 @@ call_doc_function (PyObject *obj, PyObject *method, PyObject *arg)
|
||||||
{
|
{
|
||||||
PyErr_SetString (PyExc_RuntimeError,
|
PyErr_SetString (PyExc_RuntimeError,
|
||||||
_("Parameter must return a string value."));
|
_("Parameter must return a string value."));
|
||||||
Py_DECREF (result);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue