The documentation here:
says to use BufferedRWPair as follows:
ser = serial.serial_for_url('loop://', timeout=1)
sio = io.TextIOWrapper(io.BufferedRWPair(ser, ser))
However, I had problems with input lines disappearing. The Python documentation for io.BufferedRWPair says, "Warning: BufferedRWPair does not attempt to synchronize accesses to its underlying raw streams. You should not pass it the same object as reader and writer; use BufferedRandom instead."
I found that I could simply use something like sio = io.TextIOWrapper(ser)
I'm not sure what was intended by the example using io.BufferedRWPair. Please confirm and update the documentation.