[issue45617] sys.stdin does not iterate correctly on '\r' line separator

2021-11-01 Thread Kelly Brazil
Kelly Brazil added the comment: Are there other scenarios where splitlines behavior deviates from the default of newline=None (Universal Newlines)? It seems sys.stdin (on non-Windows OS) is the outlier. All of these use Universal Newlines: - sys.stdin (on Windows) - open(0, 'r') - str.splitl

[issue45617] sys.stdin does not iterate correctly on '\r' line separator

2021-10-30 Thread Éric Araujo
Éric Araujo added the comment: > '\r' support is implicitly documented under the sys.stdin section[0]: > "These streams are regular text files like those returned by the open() > function" I read that to mean that the streams are file-like objects (or TextIOWrappers) without using that term,

[issue45617] sys.stdin does not iterate correctly on '\r' line separator

2021-10-27 Thread Kelly Brazil
Kelly Brazil added the comment: Also, I believe this docstring is being inherited, but this is also where it seems that '\r' is documented to work with sys.stdin: >>> print(sys.stdin.__doc__) Character and line based layer over a BufferedIOBase object, buffer. encoding gives the name of the

[issue45617] sys.stdin does not iterate correctly on '\r' line separator

2021-10-27 Thread Eryk Sun
Eryk Sun added the comment: > like those returned by the open() function. Their parameters are > chosen as follows..." The `newline` argument for sys.std* isn't documented, but it should be. It happens to be newline='\n' on every platform except Windows. > its newlines attribute is set to N

[issue45617] sys.stdin does not iterate correctly on '\r' line separator

2021-10-27 Thread Kelly Brazil
Kelly Brazil added the comment: '\r' support is implicitly documented under the sys.stdin section[0]: "These streams are regular text files like those returned by the open() function. Their parameters are chosen as follows..." By following the link to the open()[1] docs, it says: "newline c

[issue45617] sys.stdin does not iterate correctly on '\r' line separator

2021-10-26 Thread Eryk Sun
Eryk Sun added the comment: > '\r' is not handled, though it is documented that it > should be supported. Where is it documented that sys.stdin uses universal newlines mode? The newline behavior isn't documented in the sys module [1], though it should be. It's hard coded in create_stdio() i

[issue45617] sys.stdin does not iterate correctly on '\r' line separator

2021-10-26 Thread Kelly Brazil
Change by Kelly Brazil : -- components: +Library (Lib) ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:

[issue45617] sys.stdin does not iterate correctly on '\r' line separator

2021-10-26 Thread Kelly Brazil
New submission from Kelly Brazil : 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