+2020-09-15 Tom Tromey <tromey@adacore.com>
+
+ * 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.
+
2020-09-15 Tom Tromey <tromey@adacore.com>
* python/python-internal.h (gdb_py_long_from_ulongest): Remove
INFPY_REQUIRE_VALID (inf);
- return PyLong_FromLong (inf->inferior->num);
+ return gdb_py_object_from_longest (inf->inferior->num).release ();
}
static PyObject *
INFPY_REQUIRE_VALID (inf);
- return PyLong_FromLong (inf->inferior->pid);
+ return gdb_py_object_from_longest (inf->inferior->pid).release ();
}
static PyObject *
if (evpy_add_attribute (event.get (), "address", addr_obj.get ()) < 0)
return NULL;
- gdbpy_ref<> len_obj (PyLong_FromLong (len));
+ gdbpy_ref<> len_obj = gdb_py_object_from_longest (len);
if (len_obj == NULL)
return NULL;
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. */
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).
{
lazy_string_object *self_string = (lazy_string_object *) self;
- return PyLong_FromLong (self_string->length);
+ return gdb_py_object_from_longest (self_string->length).release ();
}
static PyObject *
{
gdbpy_tui_window *win = (gdbpy_tui_window *) self;
REQUIRE_WINDOW (win);
- return PyLong_FromLong (win->window->viewport_width ());
+ gdbpy_ref<> result
+ = gdb_py_object_from_longest (win->window->viewport_width ());
+ return result.release ();
}
/* Return the height of the TUI window. */
{
gdbpy_tui_window *win = (gdbpy_tui_window *) self;
REQUIRE_WINDOW (win);
- return PyLong_FromLong (win->window->viewport_height ());
+ gdbpy_ref<> result
+ = gdb_py_object_from_longest (win->window->viewport_height ());
+ return result.release ();
}
/* Return the title of the TUI window. */
if (PyObject_SetAttrString (result.get (), "is_base_class", arg.get ()) < 0)
return NULL;
- arg.reset (PyLong_FromLong (TYPE_FIELD_BITSIZE (type, field)));
+ arg = gdb_py_object_from_longest (TYPE_FIELD_BITSIZE (type, field));
if (arg == NULL)
return NULL;
if (PyObject_SetAttrString (result.get (), "bitsize", arg.get ()) < 0)
break;
}
- gdbpy_ref<> low_bound (PyLong_FromLong (low));
+ gdbpy_ref<> low_bound = gdb_py_object_from_longest (low);
if (low_bound == NULL)
return NULL;
- gdbpy_ref<> high_bound (PyLong_FromLong (high));
+ gdbpy_ref<> high_bound = gdb_py_object_from_longest (high);
if (high_bound == NULL)
return NULL;
/* Fall through. */
case var_zinteger:
case var_zuinteger_unlimited:
- return PyLong_FromLong (* (int *) var);
+ return gdb_py_object_from_longest (* (int *) var).release ();
case var_uinteger:
{