[issue14228] It is impossible to catch sigint on startup in python code

poq report at bugs.python.org
Fri Mar 23 15:42:18 CET 2012


poq <poq at gmx.com> added the comment:

> No, the point is that the exception may be caused by a real bug and having the traceback is tremendously useful to debug such situations. [...] KeyboardInterrupt is not different in this regard from, say, ZeroDivisionError.

KeyboardInterrupt *is* different though. It is caused by the user instead of by any bug.

Of course, it can still be useful to know where the program was interrupted, so showing a traceback for KeyboardInterrupt by default makes sense IMO.

> As I said, a possible solution is to allow users to alter the default signal handling (using an env var).

Why an environment variable instead of a command line switch (as suggested by Ian Jackson)? Shouldn't a script be able to decide for itself how it handles signals?

----------

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


More information about the Python-bugs-list mailing list