[Python-Dev] [Python-checkins] r83763 - in python/branches/py3k: Doc/library/signal.rst Lib/test/test_signal.py Misc/NEWS Modules/signalmodule.c (original) (raw)
Brian Curtin brian.curtin at gmail.com
Sat Aug 7 16:42:31 CEST 2010
- Previous message: [Python-Dev] [Python-checkins] r83763 - in python/branches/py3k: Doc/library/signal.rst Lib/test/test_signal.py Misc/NEWS Modules/signalmodule.c
- Next message: [Python-Dev] builtin round 2.7
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, Aug 7, 2010 at 08:21, Hirokazu Yamamoto <ocean-city at m2.ccsnet.ne.jp>wrote:
On 2010/08/07 19:18, Ronald Oussoren wrote:
On 7 Aug, 2010, at 10:24, Hirokazu Yamamoto wrote: This is the idea just popped up. :-)
#define SIG(name) if (signum != SIG##name) SIG(ABRT) SIG(FPE) SIG(ILL) SIG(INT) SIG(SEGV) SIG(TERM) { PyErrSetString(PyExcValueError, "signal number out of range"); return NULL; } #undef SIG
What's wrong with: switch (signum) { case SIGABRT: case SIGFPE: ... case SIGTERM: break; default: PyErrSetString(...) return NULL; } That would IMO be clearer than the macro you propose. Ronald Hmm... I liked the macro idea, but nothing is wrong with switch statement.
I had thought about doing this via switch statement. I'll propose a patch and post it on #9324.
As for the "out of range" comment -- true, it's not technically a range on Windows, but it matches the exception wording when we raise on Mac/Linux for the same reason. I can change that. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20100807/85bfbebc/attachment-0001.html>
- Previous message: [Python-Dev] [Python-checkins] r83763 - in python/branches/py3k: Doc/library/signal.rst Lib/test/test_signal.py Misc/NEWS Modules/signalmodule.c
- Next message: [Python-Dev] builtin round 2.7
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]