From 062534d44f3eeb81903cc01ef0230cee5b3e4eb2 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 15 Sep 2020 11:08:56 -0600 Subject: Don't use PyLong_FromLong This changes gdb to avoid PyLong_FromLong, preferring to gdb_py_object_from_longest instead. gdb/ChangeLog 2020-09-15 Tom Tromey * python/python.c (gdbpy_parameter_value): Use gdb_py_object_from_longest. * python/py-type.c (convert_field, typy_range): Use gdb_py_object_from_longest. * python/py-tui.c (gdbpy_tui_width, gdbpy_tui_height): Use gdb_py_object_from_longest. * python/py-lazy-string.c (stpy_get_length): Use gdb_py_object_from_longest. * python/py-infthread.c (thpy_get_num, thpy_get_global_num): Use gdb_py_object_from_longest. * python/py-infevents.c (create_memory_changed_event_object): Use gdb_py_object_from_longest. * python/py-inferior.c (infpy_get_num): Use gdb_py_object_from_longest. (infpy_get_pid): Likewise. --- gdb/python/py-infthread.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'gdb/python/py-infthread.c') diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c index f350e36..669b6d8 100644 --- a/gdb/python/py-infthread.c +++ b/gdb/python/py-infthread.c @@ -130,7 +130,9 @@ thpy_get_num (PyObject *self, void *closure) THPY_REQUIRE_VALID (thread_obj); - return PyLong_FromLong (thread_obj->thread->per_inf_num); + gdbpy_ref<> result + = gdb_py_object_from_longest (thread_obj->thread->per_inf_num); + return result.release (); } /* Getter for InferiorThread.global_num. */ @@ -142,7 +144,9 @@ thpy_get_global_num (PyObject *self, void *closure) THPY_REQUIRE_VALID (thread_obj); - return PyLong_FromLong (thread_obj->thread->global_num); + gdbpy_ref<> result + = gdb_py_object_from_longest (thread_obj->thread->global_num); + return result.release (); } /* Getter for InferiorThread.ptid -> (pid, lwp, tid). -- cgit v1.1