title: How much can I safely sleep without input buffer overflow?
body: <p>In a Python program, using pexpect, I am trying to sleep periodically, then read out (with 0 timeout) the bytes arrived so far, from the serial port.</p>
  
  <pre><code>child = fdpexpect.fdspawn(fd, maxread=5000, ...
  ...
  while True:
    time.sleep(0.1)  # 0.1 second
    x = child.read_nonblocking(size=5000, timeout=0)
    ...
  </code></pre>
  
  <p>The serial line speed is so that only about 2304 bytes can arrive within 0.1 second, which is far less than 5000.
  Is my code safe against input data loss, due to overflow in some buffer(s)?
  If not, how could it be made safe?</p>