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

2021-03-01 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> out of date stage: needs patch -> resolved status: open -> closed ___ Python tracker ___ ___

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

2018-08-12 Thread Joshua Kinard
Joshua Kinard added the comment: I was able to modify eryksun's patch for Python-2.7.15, at least the bulk of it. It looks like the '_PyOS_SigintEvent' function is new to the 3.x branch, and despite it being a fairly simple function, it's used in a few core Python modules. So I'm not sure

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

2016-10-06 Thread Adam Bartoš
Adam Bartoš added the comment: The main reason I have extended the support of win_unicode_console to Python 2.7 was that the related issues won't be fixed there, so using win_unicode_console may fix this as well. -- ___ Python tracker

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

2016-10-06 Thread Eryk Sun
Eryk Sun added the comment: Switching to ReadConsoleW in 3.6+ solves the problem with not seeing ERROR_OPERATION_ABORTED in Windows 8+, and with proper handling this potentially solves issues with Ctrl+C handling (when I last checked there were still bugs with this in the 3.6 beta). However, t

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

2016-10-06 Thread Adam Bartoš
Adam Bartoš added the comment: Maybe this was fixed with the recent fix of #1602. -- ___ Python tracker ___ ___ Python-bugs-list maili

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

2016-03-11 Thread Eryk Sun
Eryk Sun added the comment: Background Discussion The Windows 10 console uses the condrv.sys device driver, which is set up as follows in the NT namespace: C:\>odir \ -r -n con;con*$;cond* Directory of \ Device ConDrv Driver condrv GLOBAL?? CON ->

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

2016-03-11 Thread Eryk Sun
Eryk Sun added the comment: This problem has come up in several issues now (see issue 25376 and issue 26531). I'm adding a patch for Python 3.6 to call ReadConsoleA instead of fgets in PyOS_Readline. This fixes Ctrl+C and EOF handling in Windows 10 for both the interactive shell and the built-

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

2015-12-08 Thread Emanuel Barry
Changes by Emanuel Barry : -- versions: +Python 3.3, Python 3.4, Python 3.6 ___ Python tracker ___ ___ Python-bugs-list mailing list U

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

2015-12-08 Thread Troy Hirni
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: ...

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

2015-07-01 Thread eryksun
eryksun added the comment: In Windows 10 ReadFile doesn't set ERROR_OPERATION_ABORTED (995) for Ctrl+C when reading console input, but ReadConsole does. >>> from ctypes import * >>> kernel32 = WinDLL('kernel32', use_last_error=True) >>> buf = (c_char * 1)() >>> n = c_uint()

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

2014-07-31 Thread Drekin
Drekin added the comment: Shouldn't there be a Ctrl-C check in Modules/_io/fileio.c:fileio_read* functions? I think some of these are called by standard sys.stdin.readline(). -- ___ Python tracker

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

2014-07-30 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python

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

2013-08-25 Thread Drekin
Drekin added the comment: Why are there actually more codepaths which may raise this issue? My naive idea would be that input() is just thin wrapper around sys.stdout.write() (for prompt) and sys.stdin.readline() which leads to sys.stdin.buffer.raw.read* where is the place where some low level

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

2013-07-30 Thread Tim Golden
Tim Golden added the comment: Thanks for doing the investigation. Yes, that comment was added by me as part of the fix for issue1677. I'll try to have a look at the codepath you describe to see if we can add a similar workaround. The Ctrl-C / SIGINT handling on Windows is less than ideal, I admit

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

2013-07-30 Thread Drekin
Drekin added the comment: I haven't experience with Python C code but I tried to find some clues in the code. First for input(): it call PyOS_Readline which may call PyOS_StdioReadline > my_fgets > fgets in Parser/myreadline.c. There is Windows related comment on line 56: “Ctrl-C anywhere on

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

2013-07-30 Thread Tim Golden
Tim Golden added the comment: The Ctrl-C handling in Python on Windows is a bit strange in places. I'll add this to my list of things to look at. If you'd care to walk through the code to produce a patch or at least to point to suspect code, that would make it more likely that it be fixed. --

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

2013-07-30 Thread Drekin
New submission from Drekin: When I run sys.stdin.readline() interactivelly (on Windows and Python 3.3.2) and hit Ctrl-C, sometimes it returns an empty string just before KeyboardInterrupt is raised. Sometimes it isn't even raised and instead after hitting Return some weird SyntaxtError: unknow