This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kbrazil
Recipients kbrazil
Date 2021-10-26.19:20:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1635276029.13.0.174464623283.issue45617@roundup.psfhosted.org>
In-reply-to
Content
When iterating on sys.stdin lines, '\r\n' and '\n' are handled correctly, but '\r' is not handled, though it is documented that it should be supported.

Example code:
import sys

for line in sys.stdin:
    print(repr(line))

Results in Python 3.8.9:
$ echo -e 'line1\nline2\nline3' | python3 linetest.py 
'line1\n'
'line2\n'
'line3\n'

$ echo -e 'line1\r\nline2\r\nline3' | python3 linetest.py 
'line1\r\n'
'line2\r\n'
'line3\n'

$ echo -e 'line1\rline2\rline3' | python3 linetest.py 
'line1\rline2\rline3\n'
History
Date User Action Args
2021-10-26 19:20:29kbrazilsetrecipients: + kbrazil
2021-10-26 19:20:29kbrazilsetmessageid: <1635276029.13.0.174464623283.issue45617@roundup.psfhosted.org>
2021-10-26 19:20:29kbrazillinkissue45617 messages
2021-10-26 19:20:29kbrazilcreate