This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author fabioz
Recipients fabioz
Date 2020-10-15.13:22:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1602768124.79.0.2669254941.issue42044@roundup.psfhosted.org>
In-reply-to
Content
When running Python in unbuffered mode it may fail to write all the contents to the actual console (on Windows).

The code below can reproduce the issue: 

```
import sys
s = ''
for i in range(1,301):
    s += f"{str(i*100).zfill(10)}{'x' * 89}\n"

sys.stdout.write(s)
```

When calling it with `python -u code.py` it'll write only up to line 15000 and when calling it with `python code.py` it'll write up to line 30000.

This fails because in `_textiowrapper_writeflush` it doesn't verify if all the contents have been indeed written and thus fails in a partial write. In buffered mode it works because `_io_BufferedWriter_write_impl` does the job properly.

I'm a bit uncertain on why doesn't `_io__WindowsConsoleIO_write_impl` itself do the loop to write everything instead of leaving it up to callers to do that work (apparently due to issue11395 it says that it only writes partially, but maybe the fix could've been to loop inside of `_io__WindowsConsoleIO_write_impl` to write everything instead of expecting callers to handle partial writes...
History
Date User Action Args
2020-10-15 13:22:04fabiozsetrecipients: + fabioz
2020-10-15 13:22:04fabiozsetmessageid: <1602768124.79.0.2669254941.issue42044@roundup.psfhosted.org>
2020-10-15 13:22:04fabiozlinkissue42044 messages
2020-10-15 13:22:04fabiozcreate