forked from Imagelibrary/binutils-gdb
Change one more spot to use gdbpy_ref
This patch changes one more spot in the Python layer to use gdbpy_ref. gdb/ChangeLog 2017-02-10 Tom Tromey <tom@tromey.com> * python/py-prettyprint.c (pretty_print_one_value): Use gdbpy_ref.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2017-02-10 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* python/py-prettyprint.c (pretty_print_one_value): Use
|
||||||
|
gdbpy_ref.
|
||||||
|
|
||||||
2017-02-10 Tom Tromey <tom@tromey.com>
|
2017-02-10 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* python/py-cmd.c (cmdpy_destroyer): Use gdbpy_ref.
|
* python/py-cmd.c (cmdpy_destroyer): Use gdbpy_ref.
|
||||||
|
|||||||
@@ -190,21 +190,22 @@ find_pretty_printer (PyObject *value)
|
|||||||
static PyObject *
|
static PyObject *
|
||||||
pretty_print_one_value (PyObject *printer, struct value **out_value)
|
pretty_print_one_value (PyObject *printer, struct value **out_value)
|
||||||
{
|
{
|
||||||
PyObject *result = NULL;
|
gdbpy_ref<> result;
|
||||||
|
|
||||||
*out_value = NULL;
|
*out_value = NULL;
|
||||||
TRY
|
TRY
|
||||||
{
|
{
|
||||||
result = PyObject_CallMethodObjArgs (printer, gdbpy_to_string_cst, NULL);
|
result.reset (PyObject_CallMethodObjArgs (printer, gdbpy_to_string_cst,
|
||||||
if (result)
|
NULL));
|
||||||
|
if (result != NULL)
|
||||||
{
|
{
|
||||||
if (! gdbpy_is_string (result) && ! gdbpy_is_lazy_string (result)
|
if (! gdbpy_is_string (result.get ())
|
||||||
|
&& ! gdbpy_is_lazy_string (result.get ())
|
||||||
&& result != Py_None)
|
&& result != Py_None)
|
||||||
{
|
{
|
||||||
*out_value = convert_value_from_python (result);
|
*out_value = convert_value_from_python (result.get ());
|
||||||
if (PyErr_Occurred ())
|
if (PyErr_Occurred ())
|
||||||
*out_value = NULL;
|
*out_value = NULL;
|
||||||
Py_DECREF (result);
|
|
||||||
result = NULL;
|
result = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -214,7 +215,7 @@ pretty_print_one_value (PyObject *printer, struct value **out_value)
|
|||||||
}
|
}
|
||||||
END_CATCH
|
END_CATCH
|
||||||
|
|
||||||
return result;
|
return result.release ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the display hint for the object printer, PRINTER. Return
|
/* Return the display hint for the object printer, PRINTER. Return
|
||||||
|
|||||||
Reference in New Issue
Block a user