Skip to content

Commit

Permalink
bpo-30544: _io._WindowsConsoleIO.write raises the wrong error when Wr…
Browse files Browse the repository at this point in the history
…iteConsoleW fails (#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
  • Loading branch information
segevfiner authored and zooba committed Jun 2, 2017
1 parent 7a82f9c commit 523776c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Modules/_io/winconsoleio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ _io__WindowsConsoleIO_write_impl(winconsoleio *self, Py_buffer *b)
wlen = MultiByteToWideChar(CP_UTF8, 0, b->buf, len, wbuf, wlen);
if (wlen) {
res = WriteConsoleW(self->handle, wbuf, wlen, &n, NULL);
if (n < wlen) {
if (res && n < wlen) {
/* Wrote fewer characters than expected, which means our
* len value may be wrong. So recalculate it from the
* characters that were written. As this could potentially
Expand Down

0 comments on commit 523776c

Please sign in to comment.