[Python-Dev] [Python-checkins] r83763 - in python/branches/py3k: Doc/library/signal.rst Lib/test/test_signal.py Misc/NEWS Modules/signalmodule.c

Ronald Oussoren ronaldoussoren at mac.com
Sat Aug 7 12:18:55 CEST 2010


On 7 Aug, 2010, at 10:24, Hirokazu Yamamoto wrote:

> This is the idea just popped up. :-)
> 
> #define SIG(name) if (sig_num != SIG##name)
>    SIG(ABRT) SIG(FPE) SIG(ILL) SIG(INT) SIG(SEGV) SIG(TERM) {
>         PyErr_SetString(PyExc_ValueError, "signal number out of range");
>         return NULL;
>     }
> #undef SIG

What's wrong with:

switch (sig_num) {
case SIGABRT: 
case SIGFPE:
...
case SIGTERM:
       break;
default:
      PyErr_SetString(...)
      return NULL;
}

That would IMO be clearer than the macro you propose.

Ronald
> 
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/ronaldoussoren%40mac.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3567 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100807/bf594fd9/attachment.bin>


More information about the Python-Dev mailing list