diff options
author | Tom Tromey <tom@tromey.com> | 2016-11-20 10:13:31 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-01-10 19:14:00 -0700 |
commit | 64081434cce13f38288d82d3d31b6199e9deff4a (patch) | |
tree | 4b2bca4e6d109832a48a90aef07396bdf8d09863 /gdb/python | |
parent | 59e9e83119a528f17afea89ee22195a95322c6d6 (diff) | |
download | gdb-64081434cce13f38288d82d3d31b6199e9deff4a.zip gdb-64081434cce13f38288d82d3d31b6199e9deff4a.tar.gz gdb-64081434cce13f38288d82d3d31b6199e9deff4a.tar.bz2 |
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 <tom@tromey.com>
* python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Use
gdbpy_ref.
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/py-breakpoint.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index f3520cc..f268b2b 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 (); |