[issue14228] SIGINT (Ctrl-C) not caught at startup

Antoine Pitrou report at bugs.python.org
Thu Mar 8 20:06:15 CET 2012


Antoine Pitrou <pitrou at free.fr> added the comment:

> Regarding "feature request": I think this is a *bug*, not a feature
> request: For me, it is impossible to handle SIGINT correctly with my
> code, because it is half-handled (exception raised, but impossible to
> catch) by python itself.

In the trace you just posted, I see "caught signint in parent" (at the
beginning), so the exception was indeed caught.

> When starting to read "python shipped code" (i.e. stuff that comes
> with python and is always loaded), it should either implement a
> handler for sigint OR have sigint signal handler set to ignore.

Well, it does implement a SIGINT handler, and that handler raises
KeyboardInterrupt. QED. You can override that behaviour and register
your own handler using the standard "signal" module.
http://docs.python.org/dev/library/signal.html

----------

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


More information about the Python-bugs-list mailing list