Skip to content

Conversation

@segevfiner
Copy link
Contributor

@segevfiner segevfiner commented Jul 9, 2017

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 closed this Jul 9, 2017
@segevfiner segevfiner deleted the winconsole-writer-bug branch July 9, 2017 22:05
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

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

1 participant