[issue6901] Runaway programs often become unresponsive to CTRL-C

Bernie H. Innocenti report at bugs.python.org
Sun Sep 13 20:36:00 CEST 2009


Bernie H. Innocenti <bernie at codewiz.org> added the comment:

> This is a fundemental behavior that will never change. If you
> dislike it, you can remove the signal handler for it with the
> signal module.

What?  We could break the syntax of "print" statements and
cannot change this minor detail that afftects many 1% of all
Python programs?

As a matter of fact, for 2 years I've been using this in my
/usr/lib64/python2.6/sitecustomize.py:

----cut-----
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
----cut-----

^C has been working perfectly ever since.  So far, I have not
yet found a single Python program where restoring the default
behavior of SIGINT causes real issues, but there may certainly
be a few.

Granted, this is just a kludge, not a perfect fix, but from a
user perspective, it already improves upon the current behavior
(i.e. more pros than cons).

At least, this is my personal experience.  If you're skeptical,
please try this workaround yourself for a few months and let me
know what breaks for you.

----------

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


More information about the Python-bugs-list mailing list