[New-bugs-announce] [issue28166] WindowsConsoleIO misbehavior when Ctrl+C is ignored

Eryk Sun report at bugs.python.org
Thu Sep 15 04:10:25 EDT 2016


New submission from Eryk Sun:

_PyOS_WindowsConsoleReadline should continue to read when interrupted by Ctrl+C if SIGINT is ignored or the handler doesn't raise an exception. Currently it breaks out of the read loop, which looks like an EOF:

    >>> import signal
    >>> signal.signal(signal.SIGINT, signal.SIG_IGN)
    <built-in function default_int_handler>
    >>> input()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    EOFError 

Also, in this case Ctrl+C quits the REPL. 

Similarly sys.stdin.buffer.raw should retry a read. Instead a read(1) returns an empty string and readall() raises an exception:

    >>> sys.stdin.buffer.raw.read(1)
    b''

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

----------
components: IO, Library (Lib), Windows
messages: 276530
nosy: eryksun, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: test needed
status: open
title: WindowsConsoleIO misbehavior when Ctrl+C is ignored
type: behavior
versions: Python 3.6, Python 3.7

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


More information about the New-bugs-announce mailing list