bpo-30544: _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails#1912
Merged
zooba merged 2 commits intopython:masterfrom Jun 2, 2017
Merged
bpo-30544: _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails#1912zooba merged 2 commits intopython:masterfrom
zooba merged 2 commits intopython:masterfrom
Conversation
…iteConsoleW fails
eryksun
reviewed
Jun 2, 2017
Modules/_io/winconsoleio.c
Outdated
| wlen = MultiByteToWideChar(CP_UTF8, 0, b->buf, len, wbuf, wlen); | ||
| if (wlen) { | ||
| res = WriteConsoleW(self->handle, wbuf, wlen, &n, NULL); | ||
| if (!res) |
Contributor
There was a problem hiding this comment.
There's no point in calculating len if the call failed, so why not instead add this to the following test, i.e. (res && n < wlen)?
…iteConsoleW fails
zooba
approved these changes
Jun 2, 2017
Member
zooba
left a comment
There was a problem hiding this comment.
Looks good to me. Ignore the AppVeyor failure - it is unrelated.
Member
|
Forgot that I can just hit merge (different processes for me on different projects). Still needs a backport - I'll try to get to it today, but if someone else cherrypicks the change into 3.6 and submits as a PR, mention me and I'll merge. |
Contributor
Author
Member
|
@segevfiner Merged that one too. Thanks! |
zooba
pushed a commit
to zooba/cpython
that referenced
this pull request
Jun 2, 2017
…iteConsoleW fails (python#1912) * bpo-30544: _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails * bpo-30544: _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails
zooba
added a commit
that referenced
this pull request
Jun 2, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found due to this: pytest-dev/py#103