From 5e1964ee86be05dbc56f50a36da8da2172618655 Mon Sep 17 00:00:00 2001 From: jan iversen Date: Tue, 10 Oct 2023 09:37:17 +0200 Subject: [PATCH] W 1. --- pymodbus/transport/transport_serial.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pymodbus/transport/transport_serial.py b/pymodbus/transport/transport_serial.py index 29a29aafa..09f4a7663 100644 --- a/pymodbus/transport/transport_serial.py +++ b/pymodbus/transport/transport_serial.py @@ -132,12 +132,10 @@ def abort(self): def _read_ready(self): """Test if there are data waiting.""" try: - data = self.sync_serial.read(1024) + if data := self.sync_serial.read(1024): + self._protocol.data_received(data) except serial.SerialException as exc: self.close(exc=exc) - else: - if data: - self._protocol.data_received(data) def _write_ready(self): """Asynchronously write buffered data."""