[Python-Dev] Python signal processing question

Stephen J. Turnbull stephen at xemacs.org
Thu Jul 22 06:00:16 CEST 2010


Greg Ewing writes:
 > Scott McCarty wrote:
 > > All, I have searched everywhere (mostly the code and a little google) 
 > > and I cannot understand where the SIGKILL signal gets checked when it is 
 > > set as a handler.
 > 
 > Possibly it's not being checked at all by Python, but
 > is being rejected by the system call. The Darwin man
 > page says this about signal(3) in the ERRORS section:
 > 
 >       [EINVAL]           An attempt is made to ignore or supply a handler for
 >                          SIGKILL or SIGSTOP.

The Linux signal(2) manpage just says

       EINVAL               signum is invalid.

But I suppose that could be stretched to cover "SIGKILL, SIGSTOP, or
not a signal number known to the kernel".

 > Not sure why it gets reported as a RuntimeError rather
 > than an OSError, though.

My understanding of OSError is that the OS is saying "sorry, what you
tried to do is perfectly reasonable under some circumstances, but you
can't do that now."  ENOMEM, EPERM, ENOENT etc fit this model.

RuntimeError OTOH is basically saying "You should know better than to
try that!"  EINVAL fits this model.


More information about the Python-Dev mailing list