Change inferior_to_inferior_object to return a gdbpy_ref

Most callers of inferior_to_inferior_object already use a gdbpy_ref,
so this changes inferior_to_inferior_object to return one.  Doing this
revealed that create_thread_object was not correctly handling the case
where inferior_to_inferior_object failed, so this patch fixes this as
well.

gdb/ChangeLog
2019-01-02  Tom Tromey  <tom@tromey.com>

	* python/python-internal.h (inferior_to_inferior_object): Change
	return type.
	* python/py-exitedevent.c (create_exited_event_object): Update.
	* python/py-inferior.c (inferior_to_inferior_object): Return
	gdbpy_ref.
	(python_new_inferior, python_inferior_deleted)
	(thread_to_thread_object, delete_thread_object)
	(build_inferior_list, gdbpy_selected_inferior): Update.
	* python/py-infthread.c (create_thread_object): Update.  Also fail
	if inferior_to_inferior_object fails.
This commit is contained in:
Tom Tromey 2019-01-02 09:58:14 -07:00
parent d20172fc53
commit 61fd3e7389
5 changed files with 31 additions and 16 deletions

View file

@ -521,7 +521,7 @@ PyObject *gdbarch_to_arch_object (struct gdbarch *gdbarch);
thread_object *create_thread_object (struct thread_info *tp);
gdbpy_ref<> thread_to_thread_object (thread_info *thr);;
inferior_object *inferior_to_inferior_object (inferior *inf);
gdbpy_ref<inferior_object> inferior_to_inferior_object (inferior *inf);
const struct block *block_object_to_block (PyObject *obj);
struct symbol *symbol_object_to_symbol (PyObject *obj);