PR python/14387:

* python/py-bpevent.c (create_breakpoint_event_object): Update
	comment.
	* python/py-event.c (evpy_add_attribute): Update comment.
	* python/py-exitedevent.c (create_exited_event_object): Fix
	reference counting and error handling.
	* python/py-newobjfileevent.c (create_new_objfile_event_object):
	Fix reference counting.
	* python/py-signalevent.c (create_signal_event_object): Fix
	reference counting and error handling.
	* python/py-stopevent.c (emit_stop_event): Fix reference
	counting.
	* python/py-threadevent.c (get_event_thread): Return a
	borrowed reference.
	* python/py-type.c (convert_field): Fix reference counting.
This commit is contained in:
Tom Tromey 2012-08-15 14:22:02 +00:00
parent a036ba48ef
commit db6573d664
9 changed files with 63 additions and 19 deletions

View file

@ -25,30 +25,41 @@ static PyObject *
create_exited_event_object (const LONGEST *exit_code, struct inferior *inf)
{
PyObject *exited_event;
PyObject *inf_obj;
PyObject *inf_obj = NULL;
exited_event = create_event_object (&exited_event_object_type);
if (!exited_event)
goto fail;
if (exit_code
&& evpy_add_attribute (exited_event,
"exit_code",
PyLong_FromLongLong (*exit_code)) < 0)
goto fail;
if (exit_code)
{
PyObject *exit_code_obj = PyLong_FromLongLong (*exit_code);
int failed;
if (exit_code_obj == NULL)
goto fail;
failed = evpy_add_attribute (exited_event, "exit_code",
exit_code_obj) < 0;
Py_DECREF (exit_code_obj);
if (failed)
goto fail;
}
inf_obj = inferior_to_inferior_object (inf);
if (!inf_obj || evpy_add_attribute (exited_event,
"inferior",
inf_obj) < 0)
goto fail;
Py_DECREF (inf_obj);
return exited_event;
fail:
Py_XDECREF (exited_event);
return NULL;
fail:
Py_XDECREF (inf_obj);
Py_XDECREF (exited_event);
return NULL;
}
/* Callback that is used when an exit event occurs. This function