Yes, yes, thank you both. That is exactly what I didn't understand, I knew it was some how linked to the C library and wasn't exactly being handled or decided at the Python layer, I just didn't understand the C part good enough. I have found the CPython source code that checks. I see what you are saying, it is basically checking for SIG_ERR like the C code and just setting the RuntimeError which forces an exit, thereby making the python module respond in a way very similar to the C library.
Here is the CPython code in Modules/signalmodule.c if (PyOS_setsig(sig_num, func) == SIG_ERR) { PyErr_SetFromErrno(PyExc_RuntimeError); return NULL; } Second, I would like to apologize, this list is amazing, and I made a stupid comment on the core developers mailing list this morning because I didn't understand that this was the right place to post this question. Thank You Scott M On Mon, Jul 19, 2010 at 2:06 PM, Antoine Pitrou <solip...@pitrou.net> wrote: > > Hello, > > > I am not asking about the signals, I understand them, > > I am asking about the registration of the SIGNAL handler and how it knows > > that you are trying to register SIGKILL, you get an error like this. > > > > ./signal-catcher.py > > Traceback (most recent call last): > > File "./signal-catcher.py", line 22, in <module> > > signal.signal(signal.SIGKILL, signal_handler_kill) > > RuntimeError: (22, 'Invalid argument') > > >>> import errno > >>> errno.errorcode[22] > 'EINVAL' > > EINVAL is the error returned by the standard POSIX signal() function > when trying to register a handler for SIGKILL. As the signal() man page > says: > > [...] > The signals SIGKILL and SIGSTOP cannot be caught or ignored. > [...] > ERRORS > EINVAL signum is invalid. > > > So, in short, Python doesn't check SIGKILL by itself. It's just > forbidden by the underlying C standard library, and Python propagates > the error as a RuntimeError. > > Regards > > Antoine. > > > -- > http://mail.python.org/mailman/listinfo/python-list >
-- http://mail.python.org/mailman/listinfo/python-list