This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA 04/13] Use gdbpy_ref in bpfinishpy_out_of_scope
- From: Tom Tromey <tom at tromey dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tom at tromey dot com>
- Date: Sun, 20 Nov 2016 13:41:27 -0700
- Subject: [RFA 04/13] Use gdbpy_ref in bpfinishpy_out_of_scope
- Authentication-results: sourceware.org; auth=none
- References: <1479674496-14000-1-git-send-email-tom@tromey.com>
This changes bpfinishpy_out_of_scope to use gdbpy_ref.
2016-11-20 Tom Tromey <tom@tromey.com>
* python/py-finishbreakpoint.c (bpfinishpy_out_of_scope): Use
gdbpy_ref.
---
gdb/ChangeLog | 5 +++++
gdb/python/py-finishbreakpoint.c | 7 +++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c4a1f71..83ad836 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2016-11-20 Tom Tromey <tom@tromey.com>
+ * python/py-finishbreakpoint.c (bpfinishpy_out_of_scope): Use
+ gdbpy_ref.
+
+2016-11-20 Tom Tromey <tom@tromey.com>
+
* python/py-cmd.c (cmdpy_completer_helper): Use gdbpy_ref. Remove
extra incref.
(cmdpy_completer_handle_brkchars, cmdpy_completer, cmdpy_init):
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index fdac696..391e735 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -30,6 +30,7 @@
#include "inferior.h"
#include "block.h"
#include "location.h"
+#include "py-ref.h"
/* Function that is called when a Python finish bp is found out of scope. */
static char * const outofscope_func = "out_of_scope";
@@ -337,12 +338,10 @@ bpfinishpy_out_of_scope (struct finish_breakpoint_object *bpfinish_obj)
if (bpfinish_obj->py_bp.bp->enable_state == bp_enabled
&& PyObject_HasAttrString (py_obj, outofscope_func))
{
- PyObject *meth_result;
-
- meth_result = PyObject_CallMethod (py_obj, outofscope_func, NULL);
+ gdbpy_ref meth_result (PyObject_CallMethod (py_obj, outofscope_func,
+ NULL));
if (meth_result == NULL)
gdbpy_print_stack ();
- Py_XDECREF (meth_result);
}
delete_breakpoint (bpfinish_obj->py_bp.bp);
--
2.7.4