Skip to content

Commit

Permalink
Fix initialization order in EtasBus (#1704)
Browse files Browse the repository at this point in the history
super.__init__ calls set_filters, which is only permissible
after the corresponding structures have been created in the child
constructor. Hence, super.__init__ must be called after the child has
finished initialization. Fixes #1693
  • Loading branch information
lumagi committed Dec 8, 2023
1 parent cc72abb commit 033be12
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions can/interfaces/etas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ def __init__(
data_bitrate: int = 2000000,
**kwargs: Dict[str, any],
):
super().__init__(channel=channel, **kwargs)

self.receive_own_messages = receive_own_messages
self._can_protocol = can.CanProtocol.CAN_FD if fd else can.CanProtocol.CAN_20

Expand Down Expand Up @@ -119,6 +117,9 @@ def __init__(

self.channel_info = channel

# Super call must be after child init since super calls set_filters
super().__init__(channel=channel, **kwargs)

def _recv_internal(
self, timeout: Optional[float]
) -> Tuple[Optional[can.Message], bool]:
Expand Down

0 comments on commit 033be12

Please sign in to comment.