The normal tty behavior is to send \r\n instead of \n. This can interact badly with some systems - in particular, if using pexpect from a buildbot with logfile set to stdout, everything is double-spaced in the logs.
It's useful to strip these out. On most systems you could probably do that by masking out termios.ONLCR during tty setup. That's not an option on my system for complicated reasons I won't get into, so this patch instead works by removing all carriage returns by regular expression on input from the tty.
Optionally remove carriage returns
I'm inclined to say that this isn't up to pexpect - you can easily strip carriage returns out after getting the data from pexpect if they're causing problems. If you still think it's a problem, please make an issue or PR on Github for it. Thanks.
https://github.com/pexpect/pexpect