mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-01 08:54:44 +08:00
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.
This commit is contained in:
@ -246,7 +246,7 @@ recpy_bt_insn_size (PyObject *self, void *closure)
|
||||
if (insn == NULL)
|
||||
return NULL;
|
||||
|
||||
return PyInt_FromLong (insn->size);
|
||||
return gdb_py_object_from_longest (insn->size).release ();
|
||||
}
|
||||
|
||||
/* Implementation of RecordInstruction.is_speculative [bool] for btrace.
|
||||
@ -342,7 +342,8 @@ recpy_bt_func_level (PyObject *self, void *closure)
|
||||
return NULL;
|
||||
|
||||
tinfo = ((recpy_element_object *) self)->thread;
|
||||
return PyInt_FromLong (tinfo->btrace.level + func->level);
|
||||
return gdb_py_object_from_longest (tinfo->btrace.level
|
||||
+ func->level).release ();
|
||||
}
|
||||
|
||||
/* Implementation of RecordFunctionSegment.symbol [gdb.Symbol] for btrace.
|
||||
@ -566,7 +567,8 @@ btpy_list_count (PyObject *self, PyObject *value)
|
||||
{
|
||||
/* We know that if an element is in the list, it is so exactly one time,
|
||||
enabling us to reuse the "is element of" check. */
|
||||
return PyInt_FromLong (btpy_list_contains (self, value));
|
||||
return gdb_py_object_from_longest (btpy_list_contains (self,
|
||||
value)).release ();
|
||||
}
|
||||
|
||||
/* Python rich compare function to allow for equality and inequality checks
|
||||
|
Reference in New Issue
Block a user