mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #11395: io.FileIO().write() clamps the data length to 32,767 bytes on
Windows if the file is a TTY to workaround a Windows bug. The Windows console returns an error (12: not enough space error) on writing into stdout if stdout mode is binary and the length is greater than 66,000 bytes (or less, depending on heap usage).
This commit is contained in:
parent
9c4efe571d
commit
e0daff1c61
3 changed files with 33 additions and 1 deletions
|
@ -712,7 +712,14 @@ fileio_write(fileio *self, PyObject *args)
|
|||
errno = 0;
|
||||
len = pbuf.len;
|
||||
#if defined(MS_WIN64) || defined(MS_WINDOWS)
|
||||
if (len > INT_MAX)
|
||||
if (len > 32767 && isatty(self->fd)) {
|
||||
/* Issue #11395: the Windows console returns an error (12: not
|
||||
enough space error) on writing into stdout if stdout mode is
|
||||
binary and the length is greater than 66,000 bytes (or less,
|
||||
depending on heap usage). */
|
||||
len = 32767;
|
||||
}
|
||||
else if (len > INT_MAX)
|
||||
len = INT_MAX;
|
||||
n = write(self->fd, pbuf.buf, (int)len);
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue