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

Andrei Kulakov report at bugs.python.org
Fri Jul 2 23:11:32 EDT 2021


Andrei Kulakov <andrei.avk at gmail.com> 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 <report at bugs.python.org>
<https://bugs.python.org/issue43336>
_______________________________________


More information about the Python-bugs-list mailing list