[issue18597] On Windows sys.stdin.readline() doesn't handle Ctrl-C properly

Troy Hirni report at bugs.python.org
Tue Dec 8 22:19:39 EST 2015


Troy Hirni added the comment:

I'm also experiencing this on Windows 8 and 10. In the bare example below, I can Ctrl-C to exit the loop. When I press Enter again, the exception at the bottom appears.

try:
  while True:
    input("? ")
except:
  pass




>>>
>>> try:
...     while True:
...             input("? ")
... except:
...     pass
...
? asdf
'asdf'
? qqwer
'qqwer'
? >>>
  File "<stdin>", line 0

    ^
SyntaxError: decoding with 'cp437' codec failed (KeyboardInterrupt: )
>>>

----------
nosy: +ebarry, troyhirni
versions: +Python 2.7 -Python 3.3, Python 3.4, Python 3.6

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


More information about the Python-bugs-list mailing list