Skip to content

Commit 78f1ce3

Browse files
authored
Fixed broken compatibility with python 3.7 (#111)
Fixes #110
1 parent f871d42 commit 78f1ce3

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

isotp/protocol.py

+34-4
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,31 @@ def inform_byte_sent(self, datalen: int) -> None:
300300
class TransportLayerLogic:
301301
LOGGER_NAME = 'isotp'
302302

303-
@dataclass(slots=True, init=False)
303+
@dataclass(init=False)
304304
class Params:
305+
__slots__ = (
306+
'stmin',
307+
'blocksize',
308+
'override_receiver_stmin',
309+
'rx_flowcontrol_timeout',
310+
'rx_consecutive_frame_timeout',
311+
'tx_padding',
312+
'wftmax',
313+
'tx_data_length',
314+
'tx_data_min_length',
315+
'max_frame_size',
316+
'can_fd',
317+
'bitrate_switch',
318+
'default_target_address_type',
319+
'rate_limit_max_bitrate',
320+
'rate_limit_window_size',
321+
'rate_limit_enable',
322+
'listen_mode',
323+
'blocking_send',
324+
'logger_name',
325+
'wait_func'
326+
)
327+
305328
stmin: int
306329
blocksize: int
307330
override_receiver_stmin: Optional[float]
@@ -518,9 +541,12 @@ def complete(self, success: bool) -> None:
518541
self.success = success
519542
self.complete_event.set()
520543

521-
@dataclass(slots=True, frozen=True)
544+
@dataclass(frozen=True)
522545
class ProcessStats:
523546
"""Some statistics produced by every ``process`` called indicating how much has been accomplish during that iteration."""
547+
548+
__slots__ = ('received', 'received_processed', 'sent', 'frame_received')
549+
524550
received: int
525551
received_processed: int
526552
sent: int
@@ -529,16 +555,20 @@ class ProcessStats:
529555
def __repr__(self):
530556
return f'<{self.__class__.__name__} received:{self.received} (processed: {self.received_processed}, sent: {self.sent})>'
531557

532-
@dataclass(slots=True, frozen=True)
558+
@dataclass(frozen=True)
533559
class ProcessRxReport:
534560
immediate_tx_required: bool
535561
frame_received: bool
536562

537-
@dataclass(slots=True, frozen=True)
563+
__slots__ = ('immediate_tx_required', 'frame_received')
564+
565+
@dataclass(frozen=True)
538566
class ProcessTxReport:
539567
msg: Optional[CanMessage]
540568
immediate_rx_required: bool
541569

570+
__slots__ = 'msg', 'immediate_rx_required'
571+
542572
RxFn = Callable[[float], Optional[CanMessage]]
543573
TxFn = Callable[[CanMessage], None]
544574
PostSendCallback = Callable[[SendRequest], None]

0 commit comments

Comments
 (0)