[New-bugs-announce] [issue43771] [Windows] stdin line buffer size

Andrey Moiseev report at bugs.python.org
Thu Apr 8 05:33:51 EDT 2021


New submission from Andrey Moiseev <o2g.org.ru at gmail.com>:

sys.stdin.readline() in Windows console only allows 512 characters on input per line. So large pastes are truncated at 512 chars, which is a bit inconvenient for prototyping.

The buffer size seems to be determined by BUFSIZ compile time constant:
https://github.com/python/cpython/blob/63298930fb531ba2bb4f23bc3b915dbf1e17e9e1/Modules/_io/winconsoleio.c#L30-L31

In C, I am able to set a larger buffer at runtime with setvbuf() call:
setvbuf(stdin, NULL, 0, 2024);

But I can't seem to make it work through ctypes.cdll.msvcrt.setvbuf

----------
components: Windows
messages: 390518
nosy: Andrey Moiseev, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: [Windows] stdin line buffer size
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43771>
_______________________________________


More information about the New-bugs-announce mailing list