mirror of
https://github.com/python/cpython.git
synced 2025-09-30 12:21:51 +00:00
bpo-30544: _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW 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
This commit is contained in:
parent
1c92c0edca
commit
c63ae1122f
1 changed files with 1 additions and 1 deletions
|
@ -1017,7 +1017,7 @@ _io__WindowsConsoleIO_write_impl(winconsoleio *self, Py_buffer *b)
|
||||||
wlen = MultiByteToWideChar(CP_UTF8, 0, b->buf, len, wbuf, wlen);
|
wlen = MultiByteToWideChar(CP_UTF8, 0, b->buf, len, wbuf, wlen);
|
||||||
if (wlen) {
|
if (wlen) {
|
||||||
res = WriteConsoleW(self->handle, wbuf, wlen, &n, NULL);
|
res = WriteConsoleW(self->handle, wbuf, wlen, &n, NULL);
|
||||||
if (n < wlen) {
|
if (res && n < wlen) {
|
||||||
/* Wrote fewer characters than expected, which means our
|
/* Wrote fewer characters than expected, which means our
|
||||||
* len value may be wrong. So recalculate it from the
|
* len value may be wrong. So recalculate it from the
|
||||||
* characters that were written. As this could potentially
|
* characters that were written. As this could potentially
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue