This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: sys.stdin.readline and KeyboardInterrupt on windows
Type: behavior Stage: resolved
Components: Windows Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: On Windows sys.stdin.readline() doesn't handle Ctrl-C properly
View: 18597
Assigned To: Nosy List: BreamoreBoy, martin.panter, miwa
Priority: normal Keywords:

Created on 2012-03-13 14:07 by miwa, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
z.py miwa, 2012-03-13 14:07
Messages (3)
msg155612 - (view) Author: Musashi Tamura (miwa) Date: 2012-03-13 14:07
I run z.py and press Ctrl-C. 

''
Traceback (most recent call last):
  File "z.py", line 7, in <module>
    print(repr(x))
KeyboardInterrupt

I think '' should not be printed. This sometimes occurs on Python 3.2.2 and 2.7.2 AMD64 on Windows7, but doesn't occur on ubuntu.
msg222184 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-07-03 14:13
FWIW the same occurs on Windows 7 with 3.5.0 but given there are known differences between Windows and *nix is this really an issue?
msg244893 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-06-06 05:21
If the interrupt truly occurred after readline() succeeded, then x should contain actual input from the user, not the empty string. So I think this is a valid bug.

However it looks like this is the same as Issue 18597, which has more discussion.
History
Date User Action Args
2022-04-11 14:57:27adminsetgithub: 58495
2015-06-06 05:21:35martin.pantersetstatus: open -> closed

superseder: On Windows sys.stdin.readline() doesn't handle Ctrl-C properly

nosy: + martin.panter
messages: + msg244893
resolution: duplicate
stage: resolved
2014-07-03 14:13:19BreamoreBoysetnosy: + BreamoreBoy
messages: + msg222184
2012-03-13 14:07:04miwacreate