Message291049
Hi Terry, this patch is what I imagined a fix would look like for Linux. I am not familiar with Idle (internally nor externally), so there may be improvements you can make.
It works as I expected for normal blocking functions and a tight “for” loop: it interrupts any blocking call, and triggers the usual SIGINT handler. If SIGINT has a Python handler (e.g. by default), that gets called which usually raises KeyboardInterrupt.
My change has a major flaw: it seems to deadlock something if you interrupt “input()” or “sys.stdin.readline()”. Perhaps you might have a better clue what the problem is. With the default SIGINT handler, this is what I see in the Idle window:
>>> input() # Press Ctrl+C
Traceback (most recent call last): <-- cursor flashing at end of line
If SIGINT is ignored, or the Python handler doesn’t raise an exception, Ctrl+C seems to have the effect of inputting a newline:
>>> input() # Press Ctrl+C
''
>>> sys.stdin.readline() # Press Ctrl+C
'\n' |
|
Date |
User |
Action |
Args |
2017-04-03 03:37:12 | martin.panter | set | recipients:
+ martin.panter, terry.reedy, njs, Mark, eryksun |
2017-04-03 03:37:12 | martin.panter | set | messageid: <1491190632.79.0.531121803883.issue29926@psf.upfronthosting.co.za> |
2017-04-03 03:37:12 | martin.panter | link | issue29926 messages |
2017-04-03 03:37:11 | martin.panter | create | |
|