Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-30544: _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails#1912

Merged
zooba merged 2 commits into
python:masterpython/cpython:masterfrom
segevfiner:bpo-30544segevfiner/cpython:bpo-30544Copy head branch name to clipboard
Jun 2, 2017
Merged

bpo-30544: _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails#1912
zooba merged 2 commits into
python:masterpython/cpython:masterfrom
segevfiner:bpo-30544segevfiner/cpython:bpo-30544Copy head branch name to clipboard

Conversation

@segevfiner

Copy link
Copy Markdown
Contributor

Found due to this: pytest-dev/py#103

Comment thread 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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)?

@zooba zooba left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Ignore the AppVeyor failure - it is unrelated.

@zooba zooba merged commit 523776c into python:master Jun 2, 2017
@zooba

zooba commented Jun 2, 2017

Copy link
Copy Markdown
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.

@segevfiner

Copy link
Copy Markdown
Contributor Author

@zooba #1920 for the AppVeyor failure.

@zooba

zooba commented Jun 2, 2017

Copy link
Copy Markdown
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
…iteConsoleW fails (#1912) (#1925)

* bpo-30544: _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails

* bpo-30544: _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails
@segevfiner segevfiner deleted the bpo-30544 branch June 2, 2017 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.