diff options
-rw-r--r-- | CHANGES.txt | 2 | ||||
-rw-r--r-- | serial/serialwin32.py | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 8359d28..f57eab7 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -456,4 +456,6 @@ Bugfixes (win32): - [Bug 3444941] ctypes.WinError() unicode error - [Bug 3550043] on Window in tools global name 'GetLastError' is not defined +- [Bug pyserial:146] flush() does nothing in windows (despite docs) + diff --git a/serial/serialwin32.py b/serial/serialwin32.py index 3802d4b..4df8041 100644 --- a/serial/serialwin32.py +++ b/serial/serialwin32.py @@ -273,6 +273,14 @@ class Win32Serial(SerialBase): else: return 0 + def flush(self): + """Flush of file like objects. In this case, wait until all data + is written.""" + while self.outWaiting(): + time.sleep(0.05) + # XXX could also use WaitCommEvent with mask EV_TXEMPTY, but it would + # require overlapped IO and its also only possible to set a single mask + # on the port--- def flushInput(self): """Clear input buffer, discarding all that is in the buffer.""" |