Skip to content

_winconsole._WindowsConsoleWriter should loop until it writes all data - #818

Closed
segevfiner wants to merge 1 commit into
pallets:masterfrom
segevfiner:winconsole-writer-bug
Closed

_winconsole._WindowsConsoleWriter should loop until it writes all data#818
segevfiner wants to merge 1 commit into
pallets:masterfrom
segevfiner:winconsole-writer-bug

Conversation

@segevfiner

@segevfinersegevfiner commented Jul 9, 2017

Copy link
Copy Markdown
Contributor

TextIOWrapper expects a buffered stream not an unbuffered one. It wont check how much data was written and will drop data if you don't write it all. Another option is to wrap in a io.BufferedWriter, which I think is what win-unicode-console does (PR #819).

This reproduces quite well on Python 3.6. Likely due to changes in TextIOWrapper.

Please review carefully that I haven't screwed up the IO loop it's easy to get this things wrong 😝

Fixes: #816

P.S. I think get_buffer is a use after free... I think you are supposed to keep the Py_buffer alive while you are using the buffer... 😖

@pcapel Could you test this so we can be sure this is really the issue?

EDIT: Now that I think about it, I probably prefer PR #819.

TextIOWrapper expects a *buffered* stream not an unbuffered one. It wont
check how much data was written and will drop data if you don't write it
all. Another option is to wrap in a io.BufferedWriter.
This reproduces quite well on Python 3.6. Likely due to changes in
TextIOWrapper.
Fixes: pallets#816
@segevfiner
segevfiner deleted the winconsole-writer-bug branch July 9, 2017 22:05
@github-actionsgithub-actionsBot locked as resolved and limited conversation to collaborators Nov 13, 2020
@kdeldyckekdeldycke added the windows Windows-specific behavior label Aug 8, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

windowsWindows-specific behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python 3.6 on Windows click.echo() truncates output click v6.7, unable to duplicate in test

2 participants

@segevfiner@kdeldycke