[issue1677] Ctrl-C will exit out of Python interpreter in Windows

Tim Golden report at bugs.python.org
Wed Jun 27 15:04:06 CEST 2012


Tim Golden <mail at timgolden.me.uk> added the comment:

OK, I've run out of time to look, but the culprit looks like it's an odd interaction between my_fgets in myreadline.c and the interrupt handler in signal. There's a section of code which is conditional on ERROR_OPERATION_ABORTED being returned from fgets in the CRT. 

That then tries to play ball with a the interrupt handler having fired already (in a separate thread) by sleeping for one second and checking that the handler was tripped. If it has then the function returns one and stuff happens elsewhere; it it hasn't then the function behaves as if EOF (ie Ctrl-Z) was pressed and Python exits.

That's as far as I've got; it looks like a race condition of some sort but I can't see where. I'm not 100% sure that the SIGINT handler is tripping.

----------

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


More information about the Python-bugs-list mailing list