Skip to content

Commit

Permalink
W 1.
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen committed Oct 10, 2023
1 parent 2a49b79 commit 5e1964e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pymodbus/transport/transport_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit 5e1964e

Please sign in to comment.