From 59f95661d77c25f47fe159684bd40fbe421d44e6 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 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pymodbus/transport/transport_serial.py b/pymodbus/transport/transport_serial.py index 29a29aafa7..5a0d1f7472 100644 --- a/pymodbus/transport/transport_serial.py +++ b/pymodbus/transport/transport_serial.py @@ -133,11 +133,10 @@ def _read_ready(self): """Test if there are data waiting.""" try: data = self.sync_serial.read(1024) - except serial.SerialException as exc: - self.close(exc=exc) - else: if data: self._protocol.data_received(data) + except serial.SerialException as exc: + self.close(exc=exc) def _write_ready(self): """Asynchronously write buffered data."""