+ utils._check_type(msg, bt2_message._Message)
+
+ # The reference we return will be given to the message array.
+ # However, the `msg` Python object may stay alive, if the user has kept
+ # a reference to it. Acquire a new reference to account for that.
+ msg._get_ref(msg._ptr)
+ return int(msg._ptr)
+
+ @property
+ def _bt_can_seek_beginning_from_native(self):
+ # Here, we mimic the behavior of the C API:
+ #
+ # - If the iterator has a _user_can_seek_beginning attribute,
+ # read it and use that result.
+ # - Otherwise, the presence or absence of a `_seek_beginning`
+ # method indicates whether the iterator can seek beginning.
+ if hasattr(self, '_user_can_seek_beginning'):
+ can_seek_beginning = self._user_can_seek_beginning
+ utils._check_bool(can_seek_beginning)
+ return can_seek_beginning
+ else:
+ return hasattr(self, '_user_seek_beginning')
+
+ def _bt_seek_beginning_from_native(self):
+ self._user_seek_beginning()
+
+ def _create_input_port_message_iterator(self, input_port):
+ utils._check_type(input_port, bt2_port._UserComponentInputPort)