<div class="gmail_quote">On Sat, Aug 7, 2010 at 08:21, Hirokazu Yamamoto <span dir="ltr"><<a href="mailto:ocean-city@m2.ccsnet.ne.jp">ocean-city@m2.ccsnet.ne.jp</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 2010/08/07 19:18, Ronald Oussoren wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
On 7 Aug, 2010, at 10:24, Hirokazu Yamamoto wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This is the idea just popped up. :-)<br>
<br>
#define SIG(name) if (sig_num != SIG##name)<br>
SIG(ABRT) SIG(FPE) SIG(ILL) SIG(INT) SIG(SEGV) SIG(TERM) {<br>
PyErr_SetString(PyExc_ValueError, "signal number out of range");<br>
return NULL;<br>
}<br>
#undef SIG<br>
</blockquote>
<br>
What's wrong with:<br>
<br>
switch (sig_num) {<br>
case SIGABRT:<br>
case SIGFPE:<br>
...<br>
case SIGTERM:<br>
break;<br>
default:<br>
PyErr_SetString(...)<br>
return NULL;<br>
}<br>
<br>
That would IMO be clearer than the macro you propose.<br>
<br>
Ronald<br>
</blockquote>
<br></div>
Hmm... I liked the macro idea, but nothing is wrong with switch<br>
statement.</blockquote><div><br></div><div>I had thought about doing this via switch statement. I'll propose a patch and post it on #9324.</div><div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">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.</span></div>
</div>