{
PyObject *py_status;
PyObject *py_return_tuple;
- PyObject *py_msg_list = Py_None;
+ PyObject *py_msg_list;
- py_status = SWIG_From_long_SS_long(status);
- if (status != __BT_FUNC_STATUS_OK) {
- goto end;
- }
-
- py_msg_list = create_pylist_from_messages(messages, message_count);
-
-end:
py_return_tuple = PyTuple_New(2);
BT_ASSERT(py_return_tuple);
+
+ /* Set tuple[0], status. */
+ py_status = SWIG_From_long_SS_long(status);
PyTuple_SET_ITEM(py_return_tuple, 0, py_status);
+
+ /* Set tuple[1], message list on success, None otherwise. */
+ if (status == __BT_FUNC_STATUS_OK) {
+ py_msg_list = create_pylist_from_messages(messages, message_count);
+ } else {
+ py_msg_list = Py_None;
+ Py_INCREF(py_msg_list);
+ }
+
PyTuple_SET_ITEM(py_return_tuple, 1, py_msg_list);
+
return py_return_tuple;
}
%}
PyObject *bt_bt2_get_user_component_from_user_msg_iter(
- bt_self_message_iterator *self_message_iterator);
+ bt_self_message_iterator *self_message_iterator);
PyObject *bt_bt2_self_component_port_input_get_msg_range(
bt_self_component_port_input_message_iterator *iter);
PyObject *bt_bt2_port_output_get_msg_range(