From: Tom Tromey Date: Sun, 20 Nov 2016 17:13:31 +0000 (-0700) Subject: Use gdbpy_ref in gdbpy_breakpoint_cond_says_stop X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=64081434cce13f38288d82d3d31b6199e9deff4a;p=binutils-gdb.git Use gdbpy_ref in gdbpy_breakpoint_cond_says_stop This changes gdbpy_breakpoint_cond_says_stop to use gdbpy_ref rather than explicit reference management. 2017-01-10 Tom Tromey * python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Use gdbpy_ref. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 49722e80019..74e32bfd4a6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2017-01-10 Tom Tromey + + * python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Use + gdbpy_ref. + 2017-01-10 Tom Tromey * python/py-arch.c (archpy_disassemble): Use gdbpy_ref. Don't diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index f3520cc8be5..f268b2bb446 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -805,12 +805,12 @@ gdbpy_breakpoint_cond_says_stop (const struct extension_language_defn *extlang, if (PyObject_HasAttrString (py_bp, stop_func)) { - PyObject *result = PyObject_CallMethod (py_bp, stop_func, NULL); + gdbpy_ref result (PyObject_CallMethod (py_bp, stop_func, NULL)); stop = 1; - if (result) + if (result != NULL) { - int evaluate = PyObject_IsTrue (result); + int evaluate = PyObject_IsTrue (result.get ()); if (evaluate == -1) gdbpy_print_stack (); @@ -819,8 +819,6 @@ gdbpy_breakpoint_cond_says_stop (const struct extension_language_defn *extlang, the Python breakpoint wants GDB to continue. */ if (! evaluate) stop = 0; - - Py_DECREF (result); } else gdbpy_print_stack ();