[issue41221] io.TextIOWrapper ignores silently partial write if buffer is unbuffered

2020-07-08 Thread Eryk Sun
Eryk Sun added the comment: > it’s probably an even bigger problem on Windows, where writes might be > limited to 32767 bytes: This check and workaround in _Py_write_impl doesn't affect disk files and pipes. It only affects character devices for which isatty is true, and really it's only

[issue41221] io.TextIOWrapper ignores silently partial write if buffer is unbuffered

2020-07-08 Thread STINNER Victor
STINNER Victor added the comment: > but it will break the code which uses TextIOWrapper with other file-like > objects whose write() method does not return the number of written bytes. We can detect if write() doesn't return an integer and don't attempt to call write() in a loop (until all

[issue41221] io.TextIOWrapper ignores silently partial write if buffer is unbuffered

2020-07-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Oh, this is a serious problem. AFAIK TextIOWrapper initially supported only buffered writers, but the support of non-buffered writers was added later. We can make TextIOWrapper calling write() of underlying binary stream repeatedly, but it will break the

[issue41221] io.TextIOWrapper ignores silently partial write if buffer is unbuffered

2020-07-07 Thread STINNER Victor
Change by STINNER Victor : -- nosy: +inada.naoki, serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue41221] io.TextIOWrapper ignores silently partial write if buffer is unbuffered

2020-07-07 Thread STINNER Victor
STINNER Victor added the comment: cc Antoine Pitrou who was involved in io module design. Currently, the io.TextIOWrapper implementation doesn't handle partial write: it doesn't fully support an unbuffered 'buffer' object. It should either handle partial write internally, or it should