[issue41221] Output of print() might get truncated in unbuffered mode

Manuel Jacob report at bugs.python.org
Mon Jul 6 23:05:32 EDT 2020


Manuel Jacob <me at manueljacob.de> added the comment:

`io.TextIOWrapper.write()` returns the length of the passed string instead of the actually written number of characters.

% python -u -c "import sys; print(sys.stdout.write('x'*4294967296), file=sys.stderr)" | wc -c 
4294967296
2147479552

So the possibility "users of `io.TextIOWrapper` call `write()` until all characters have been written" would not be sufficient.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41221>
_______________________________________


More information about the Python-bugs-list mailing list