aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-breakpoint.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2020-09-15 11:08:56 -0600
committerTom Tromey <tromey@adacore.com>2020-09-15 11:08:57 -0600
commit47f0e2ff7f0a4479c511f5d3ed4c8a962cb1f237 (patch)
tree62f0ecfdb041fc15083df188d26f10167efd907b /gdb/python/py-breakpoint.c
parent512116ce26a66338e1be1847cc8b014f4d4bbc13 (diff)
downloadbinutils-47f0e2ff7f0a4479c511f5d3ed4c8a962cb1f237.zip
binutils-47f0e2ff7f0a4479c511f5d3ed4c8a962cb1f237.tar.gz
binutils-47f0e2ff7f0a4479c511f5d3ed4c8a962cb1f237.tar.bz2
Don't use PyInt_FromLong
Avoid the use of PyInt_FromLong, preferring gdb_py_object_from_longest instead. I found found another spot that was incorrectly handling errors (see gdbpy_create_ptid_object) while writing this patch; it is fixed here. gdb/ChangeLog 2020-09-15 Tom Tromey <tromey@adacore.com> * python/python-internal.h (PyInt_FromLong): Remove define. * python/py-value.c (convert_value_from_python): Use gdb_py_object_from_longest. * python/py-type.c (typy_get_code): Use gdb_py_object_from_longest. * python/py-symtab.c (salpy_get_line): Use gdb_py_object_from_longest. * python/py-symbol.c (sympy_get_addr_class, sympy_line): Use gdb_py_object_from_longest. * python/py-record.c (recpy_gap_reason_code): Use gdb_py_object_from_longest. * python/py-record-btrace.c (recpy_bt_insn_size) (recpy_bt_func_level, btpy_list_count): Use gdb_py_object_from_longest. * python/py-infthread.c (gdbpy_create_ptid_object): Use gdb_py_object_from_longest. Fix error handling. * python/py-framefilter.c (bootstrap_python_frame_filters): Use gdb_py_object_from_longest. * python/py-frame.c (frapy_type, frapy_unwind_stop_reason): Use gdb_py_object_from_longest. * python/py-breakpoint.c (bppy_get_type, bppy_get_number) (bppy_get_thread, bppy_get_task, bppy_get_hit_count) (bppy_get_ignore_count): Use gdb_py_object_from_longest.
Diffstat (limited to 'gdb/python/py-breakpoint.c')
-rw-r--r--gdb/python/py-breakpoint.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 11345ad..7369c91 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -552,7 +552,7 @@ bppy_get_type (PyObject *self, void *closure)
BPPY_REQUIRE_VALID (self_bp);
- return PyInt_FromLong (self_bp->bp->type);
+ return gdb_py_object_from_longest (self_bp->bp->type).release ();
}
/* Python function to get the visibility of the breakpoint. */
@@ -613,7 +613,7 @@ bppy_get_number (PyObject *self, void *closure)
BPPY_REQUIRE_VALID (self_bp);
- return PyInt_FromLong (self_bp->number);
+ return gdb_py_object_from_longest (self_bp->number).release ();
}
/* Python function to get the breakpoint's thread ID. */
@@ -627,7 +627,7 @@ bppy_get_thread (PyObject *self, void *closure)
if (self_bp->bp->thread == -1)
Py_RETURN_NONE;
- return PyInt_FromLong (self_bp->bp->thread);
+ return gdb_py_object_from_longest (self_bp->bp->thread).release ();
}
/* Python function to get the breakpoint's task ID (in Ada). */
@@ -641,7 +641,7 @@ bppy_get_task (PyObject *self, void *closure)
if (self_bp->bp->task == 0)
Py_RETURN_NONE;
- return PyInt_FromLong (self_bp->bp->task);
+ return gdb_py_object_from_longest (self_bp->bp->task).release ();
}
/* Python function to get the breakpoint's hit count. */
@@ -652,7 +652,7 @@ bppy_get_hit_count (PyObject *self, void *closure)
BPPY_REQUIRE_VALID (self_bp);
- return PyInt_FromLong (self_bp->bp->hit_count);
+ return gdb_py_object_from_longest (self_bp->bp->hit_count).release ();
}
/* Python function to get the breakpoint's ignore count. */
@@ -663,7 +663,7 @@ bppy_get_ignore_count (PyObject *self, void *closure)
BPPY_REQUIRE_VALID (self_bp);
- return PyInt_FromLong (self_bp->bp->ignore_count);
+ return gdb_py_object_from_longest (self_bp->bp->ignore_count).release ();
}
/* Internal function to validate the Python parameters/keywords