From 686f4fbffa4045a55087e7f48a8b7fd39417938c Mon Sep 17 00:00:00 2001 From: jan iversen Date: Wed, 23 Oct 2024 12:18:59 +0200 Subject: [PATCH] Correct minor framer/pdu errors. --- pymodbus/framer/base.py | 1 - pymodbus/transaction.py | 4 ++-- test/framer/test_framer.py | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pymodbus/framer/base.py b/pymodbus/framer/base.py index ffdbf52ca..91ae01dda 100644 --- a/pymodbus/framer/base.py +++ b/pymodbus/framer/base.py @@ -34,7 +34,6 @@ def __init__( ) -> None: """Initialize a ADU (framer) instance.""" self.decoder = decoder - self.databuffer = b"" def decode(self, _data: bytes) -> tuple[int, int, int, bytes]: """Decode ADU. diff --git a/pymodbus/transaction.py b/pymodbus/transaction.py index 1b2f9e612..1bb67455a 100644 --- a/pymodbus/transaction.py +++ b/pymodbus/transaction.py @@ -192,10 +192,10 @@ def execute(self, no_response_expected: bool, request: ModbusPDU): # noqa: C901 request.transaction_id = 0 Log.debug("Running transaction {}", request.transaction_id) if _buffer := hexlify_packets( - self.client.framer.databuffer + self.databuffer ): Log.debug("Clearing current Frame: - {}", _buffer) - self.client.framer.databuffer = b'' + self.databuffer = b'' expected_response_length = None if not isinstance(self.client.framer, FramerSocket): response_pdu_size = request.get_response_pdu_size() diff --git a/test/framer/test_framer.py b/test/framer/test_framer.py index cce0d98bd..28ab35136 100644 --- a/test/framer/test_framer.py +++ b/test/framer/test_framer.py @@ -415,7 +415,6 @@ def test_processIncomingFrame_roundtrip(self, entry, test_framer, msg, dev_id, t assert result assert result.slave_id == dev_id assert result.transaction_id == tid - assert not test_framer.databuffer expected = test_framer.encode( result.function_code.to_bytes(1,'big') + result.encode(), dev_id, 1)