[Python-Dev] Catch SIGINT at Python startup
Victor Stinner
victor.stinner at haypocalc.com
Mon Mar 8 21:50:02 CET 2010
Hi,
Le lundi 08 mars 2010 18:47:18, Guido van Rossum a écrit :
> Actually it sounds like there's some overly general except clause
> somewhere that should be adjusted to catch just "Exception" instead of
> "*".
Most of my patches (for SIGINT) are exactly doing that: check the exception
type instead of "if (result == NULL) PyErr_Clear();" (try/except: pass). About
initsite(): I consider any error as fatal. If initsite() failed, something
goes wrong.
I think that my patches are enough to catch SIGINT during the Python
initialization. I used different tricks to test Python: add kill(getpid(),
SIGINT), use "signal SIGINT" in gdb, add
PyErr_SetNone(PyExc_KeyboardInterrupt), ... valgrind is a very good tool to
slow down any process :-D
--
Victor Stinner
http://www.haypocalc.com/
More information about the Python-Dev
mailing list