aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-bpevent.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/py-bpevent.c')
-rw-r--r--gdb/python/py-bpevent.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/gdb/python/py-bpevent.c b/gdb/python/py-bpevent.c
index f9c7083..c9b53b5 100644
--- a/gdb/python/py-bpevent.c
+++ b/gdb/python/py-bpevent.c
@@ -19,6 +19,7 @@
#include "defs.h"
#include "py-stopevent.h"
+#include "py-ref.h"
extern PyTypeObject breakpoint_event_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
@@ -29,26 +30,22 @@ extern PyTypeObject breakpoint_event_object_type
PyObject *
create_breakpoint_event_object (PyObject *breakpoint_list, PyObject *first_bp)
{
- PyObject *breakpoint_event_obj =
- create_stop_event_object (&breakpoint_event_object_type);
+ gdbpy_ref breakpoint_event_obj
+ (create_stop_event_object (&breakpoint_event_object_type));
- if (!breakpoint_event_obj)
- goto fail;
+ if (breakpoint_event_obj == NULL)
+ return NULL;
- if (evpy_add_attribute (breakpoint_event_obj,
+ if (evpy_add_attribute (breakpoint_event_obj.get (),
"breakpoint",
first_bp) < 0)
- goto fail;
- if (evpy_add_attribute (breakpoint_event_obj,
+ return NULL;
+ if (evpy_add_attribute (breakpoint_event_obj.get (),
"breakpoints",
breakpoint_list) < 0)
- goto fail;
+ return NULL;
- return breakpoint_event_obj;
-
- fail:
- Py_XDECREF (breakpoint_event_obj);
- return NULL;
+ return breakpoint_event_obj.release ();
}
GDBPY_NEW_EVENT_TYPE (breakpoint,