[issue28162] WindowsConsoleIO readall() fails if first line starts with Ctrl+Z

Eryk Sun report at bugs.python.org
Wed Sep 14 23:25:17 EDT 2016


New submission from Eryk Sun:

For a console readall(), if the first line starts with '\x1a' (i.e. Ctrl+Z), it breaks out of its read loop before incrementing len. Thus the input isn't handled properly as EOF, for which the check requires len > 0. Instead it ends up calling WideCharToMultiByte with len == 0, which fails as follows:

    >>> sys.stdin.buffer.raw.read()
    ^Z
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    OSError: [WinError 87] The parameter is incorrect

----------
components: IO, Library (Lib), Windows
messages: 276508
nosy: eryksun, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: test needed
status: open
title: WindowsConsoleIO readall() fails if first line starts with Ctrl+Z
type: behavior
versions: Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28162>
_______________________________________


More information about the Python-bugs-list mailing list