X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbindings%2Fpython%2Fbt2%2Fbt2%2Fcomponent.py;h=acc5b22c7b71e931a451cf6cc86629770ed8739b;hb=e42e1587604ec69593e13503e623688fe26ba1d1;hp=a68da615f1b542f187cc0637c83f4b7f325d94f1;hpb=056deb59eb33e87c06c0067907768ab08aff74a2;p=babeltrace.git diff --git a/src/bindings/python/bt2/bt2/component.py b/src/bindings/python/bt2/bt2/component.py index a68da615..acc5b22c 100644 --- a/src/bindings/python/bt2/bt2/component.py +++ b/src/bindings/python/bt2/bt2/component.py @@ -515,7 +515,7 @@ class _UserComponentType(type): # call user's __init__() method if params_ptr is not None: - params = bt2_value._create_from_ptr_and_get_ref(params_ptr) + params = bt2_value._create_from_const_ptr_and_get_ref(params_ptr) else: params = None @@ -574,7 +574,7 @@ class _UserComponentType(type): def _bt_get_supported_mip_versions_from_native(cls, params_ptr, obj, log_level): # this can raise, but the native side checks the exception if params_ptr is not None: - params = bt2_value._create_from_ptr_and_get_ref(params_ptr) + params = bt2_value._create_from_const_ptr_and_get_ref(params_ptr) else: params = None @@ -595,7 +595,7 @@ class _UserComponentType(type): def _bt_query_from_native(cls, priv_query_exec_ptr, object, params_ptr, method_obj): # this can raise, but the native side checks the exception if params_ptr is not None: - params = bt2_value._create_from_ptr_and_get_ref(params_ptr) + params = bt2_value._create_from_const_ptr_and_get_ref(params_ptr) else: params = None @@ -706,7 +706,9 @@ class _UserComponent(metaclass=_UserComponentType): ) self._user_port_connected(port, other_port) - def _create_trace_class(self, assigns_automatic_stream_class_id=True): + def _create_trace_class( + self, user_attributes=None, assigns_automatic_stream_class_id=True + ): ptr = self._bt_as_self_component_ptr(self._bt_ptr) tc_ptr = native_bt.trace_class_create(ptr) @@ -716,12 +718,16 @@ class _UserComponent(metaclass=_UserComponentType): tc = bt2_trace_class._TraceClass._create_from_ptr(tc_ptr) tc._assigns_automatic_stream_class_id = assigns_automatic_stream_class_id + if user_attributes is not None: + tc._user_attributes = user_attributes + return tc def _create_clock_class( self, frequency=None, name=None, + user_attributes=None, description=None, precision=None, offset=None, @@ -742,6 +748,9 @@ class _UserComponent(metaclass=_UserComponentType): if name is not None: cc._name = name + if user_attributes is not None: + cc._user_attributes = user_attributes + if description is not None: cc._description = description @@ -890,12 +899,11 @@ class _UserSinkComponent(_UserComponent, _SinkComponent): def _create_input_port_message_iterator(self, input_port): utils._check_type(input_port, bt2_port._UserComponentInputPort) - msg_iter_ptr = native_bt.self_component_port_input_message_iterator_create_from_sink_component( + status, msg_iter_ptr = native_bt.bt2_self_component_port_input_message_iterator_create_from_sink_component( self._bt_ptr, input_port._ptr ) - - if msg_iter_ptr is None: - raise bt2._MemoryError('cannot create message iterator object') + utils._handle_func_status(status, 'cannot create message iterator object') + assert msg_iter_ptr is not None return bt2_message_iterator._UserComponentInputPortMessageIterator(msg_iter_ptr)