[issue43336] document whether io.TextIOBase.readline(size>0) will always read the full newline

2021-07-02 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I don't think it's incorrect right now, from the POV of internal data of the 
stream, there's 6 chars, from the POV of caller, 5 chars are read. So this can 
be interpreted as 2 chars are combined into 1 char read.

On the other hand if TextIOBase was reading '\r' and letting caller process it 
and then reading '\n' that would be of course a recipe to shoot the user in 
the foot, and would require a warning in big red letters in the docs. (Or even 
better fixing it to do what it does now.)

--
nosy: +andrei.avk

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43336] document whether io.TextIOBase.readline(size>0) will always read the full newline

2021-03-17 Thread Christoph Anton Mitterer


Christoph Anton Mitterer  added the comment:

I guess that the translation from CRLF to LF simply happens before the size 
restriction is enforced (which is good so, btw), so effectively it:

will not *read* at most size characters from the stream, but *return* at most 
size characters from it (with any newlines translated before, and thus more 
characters read from the stream than returned)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43336] document whether io.TextIOBase.readline(size>0) will always read the full newline

2021-03-05 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +benjamin.peterson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43336] document whether io.TextIOBase.readline(size>0) will always read the full newline

2021-02-26 Thread Christoph Anton Mitterer


Christoph Anton Mitterer  added the comment:

"a n > 0size" should have read "a size > 0"

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43336] document whether io.TextIOBase.readline(size>0) will always read the full newline

2021-02-26 Thread Christoph Anton Mitterer


New submission from Christoph Anton Mitterer :

Hey.

It would be nice if the following behaviour could be definitely clarified:

When reading from a text stream with readline(size) with a n > 0size it says: 
"If size is specified, at most size characters will be read."

Also, depending on the settings of newlines of the stream, \r\n would be 
converted to \n.


It's not definitely clear whether a string like
"abc\r\n"
read with a size of = 4 will return "abc\n" (which it seems to do, in other 
words, it reads actually 5 characters, but sill returns only 4), or whether it 
returns "abc\r".


Cheers,
Chris.

--
assignee: docs@python
components: Documentation
messages: 387758
nosy: calestyo, docs@python
priority: normal
severity: normal
status: open
title: document whether io.TextIOBase.readline(size>0) will always read the 
full newline

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com