Return gdbpy_ref from gdb_py_object_from_*longest

This changes gdb_py_object_from_longest and
gdb_py_object_from_ulongest to return a gdbpy_ref rather than a
PyObject*.

gdb/ChangeLog
2018-11-04  Tom Tromey  <tom@tromey.com>

	* python/python-internal.h (gdb_py_object_from_longest)
	(gdb_py_object_from_ulongest): Return gdbpy_ref.
	* python/py-value.c (valpy_int): Update.
	* python/py-utils.c (gdb_py_object_from_longest): Return
	gdbpy_ref.
	(gdb_py_object_from_ulongest): Likewise.
	* python/py-type.c (typy_get_alignof): Update.
	* python/py-linetable.c (ltpy_get_all_source_lines)
	(ltpy_entry_get_line, ltpy_entry_get_pc): Update.
	* python/py-block.c (blpy_get_start, blpy_get_end): Update.
This commit is contained in:
Tom Tromey
2018-10-24 16:33:23 -06:00
parent 9446bd8ad6
commit 12dfa12a3c
7 changed files with 34 additions and 21 deletions

View File

@ -244,7 +244,7 @@ ltpy_get_all_source_lines (PyObject *self, PyObject *args)
include in the source set. */
if (item->line > 0)
{
gdbpy_ref<> line (gdb_py_object_from_longest (item->line));
gdbpy_ref<> line = gdb_py_object_from_longest (item->line);
if (line == NULL)
return NULL;
@ -327,7 +327,7 @@ ltpy_entry_get_line (PyObject *self, void *closure)
{
linetable_entry_object *obj = (linetable_entry_object *) self;
return gdb_py_object_from_longest (obj->line);
return gdb_py_object_from_longest (obj->line).release ();
}
/* Implementation of gdb.LineTableEntry.pc (self) -> Long. Returns a
@ -338,7 +338,7 @@ ltpy_entry_get_pc (PyObject *self, void *closure)
{
linetable_entry_object *obj = (linetable_entry_object *) self;
return gdb_py_object_from_longest (obj->pc);
return gdb_py_object_from_longest (obj->pc).release ();
}
/* LineTable iterator functions. */