This issue might serve as partial documentation.
This took a lot of digging to find. A carriage return \r received over usb serial is replaced with a new line character \n when read with e.g. sys.stdin.read(1).
The source of the change seems to be the stdio_read() function in \lib\utils\sys_stdio_mphal.c
The reason for this behavior is unclear.