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

telmich report at bugs.python.org
Thu Mar 8 19:10:49 CET 2012


telmich <nico-bugs.python.org at schottelius.org> 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.

Imho this behaviour should not be possible. Instead python could do the standard sigint behaviour, before reading python code (= exit).

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.

As soon as control flow is passed over to user code, raising KeyboardInterrupt is fine and I can catch that by enclosing all parts (including import statements) into a try: ... block that does what I want.

----------

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


More information about the Python-bugs-list mailing list