summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-02-24 16:55:51 (GMT)
committerGitHub <noreply@github.com>2018-02-24 16:55:51 (GMT)
commit42c35d9c0c8175332f50fbe034a001fe52f057b9 (patch)
tree00485d2cfcf5a47eec398a87cd6751f444978733 /Modules
parentaef1283ba428e33397d87cee3c54a5110861552d (diff)
downloadcpython-42c35d9c0c8175332f50fbe034a001fe52f057b9.zip
cpython-42c35d9c0c8175332f50fbe034a001fe52f057b9.tar.gz
cpython-42c35d9c0c8175332f50fbe034a001fe52f057b9.tar.bz2
bpo-31966: Fixed WindowsConsoleIO.write() for writing empty data. (GH-5754)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_io/winconsoleio.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c
index 30d1c76..b85c11b 100644
--- a/Modules/_io/winconsoleio.c
+++ b/Modules/_io/winconsoleio.c
@@ -964,6 +964,9 @@ _io__WindowsConsoleIO_write_impl(winconsoleio *self, Py_buffer *b)
if (!self->writable)
return err_mode("writing");
+ if (!b->len) {
+ return PyLong_FromLong(0);
+ }
if (b->len > BUFMAX)
len = BUFMAX;
else