diff options
Diffstat (limited to 'serial/serialposix.py')
-rw-r--r-- | serial/serialposix.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/serial/serialposix.py b/serial/serialposix.py index e6ef534..cff3417 100644 --- a/serial/serialposix.py +++ b/serial/serialposix.py @@ -527,7 +527,7 @@ class Serial(SerialBase, PlatformSpecific): if not self.is_open: raise portNotOpenError d = to_bytes(data) - tx_len = len(d) + tx_len = length = len(d) timeout = Timeout(self._write_timeout) while tx_len > 0: try: @@ -566,7 +566,7 @@ class Serial(SerialBase, PlatformSpecific): # still calculate and check timeout if timeout.expired(): raise writeTimeoutError - return len(data) + return length - len(d) def flush(self): """\ |