summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrian Curtin <brian.curtin@gmail.com>2010-09-06 16:10:04 (GMT)
committerBrian Curtin <brian.curtin@gmail.com>2010-09-06 16:10:04 (GMT)
commit912443c861ca29d50d37ed817072b0f0f16ac4c3 (patch)
tree188d990039487af99ad6f784b58eed0885691fa9 /Modules
parent7e00ef097499e9f900ac61eaf96760c1c6b81e8a (diff)
downloadcpython-912443c861ca29d50d37ed817072b0f0f16ac4c3.zip
cpython-912443c861ca29d50d37ed817072b0f0f16ac4c3.tar.gz
cpython-912443c861ca29d50d37ed817072b0f0f16ac4c3.tar.bz2
Merged revisions 84556 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r84556 | brian.curtin | 2010-09-06 11:04:10 -0500 (Mon, 06 Sep 2010) | 7 lines Clean up the fix to #9324 with some of the suggestions raised on python-dev in response to the original checkin. Move the validation from the original loop into a switch statement, and adjust a platform check in the tests. ........
Diffstat (limited to 'Modules')
-rw-r--r--Modules/signalmodule.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index e9abec4..c2e762a 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -252,21 +252,20 @@ signal_signal(PyObject *self, PyObject *args)
int sig_num;
PyObject *old_handler;
void (*func)(int);
-#ifdef MS_WINDOWS
- int cur_sig, num_valid_sigs = 6;
- static int valid_sigs[] = {SIGABRT, SIGFPE, SIGILL, SIGINT,
- SIGSEGV, SIGTERM};
- BOOL valid_sig = FALSE;
-#endif
if (!PyArg_ParseTuple(args, "iO:signal", &sig_num, &obj))
return NULL;
#ifdef MS_WINDOWS
/* Validate that sig_num is one of the allowable signals */
- for (cur_sig = 0; cur_sig < num_valid_sigs; cur_sig++)
- valid_sig |= (sig_num == valid_sigs[cur_sig]);
- if (!valid_sig) {
- PyErr_SetString(PyExc_ValueError, "signal number out of range");
- return NULL;
+ switch (sig_num) {
+ case SIGABRT: break;
+ case SIGFPE: break;
+ case SIGILL: break;
+ case SIGINT: break;
+ case SIGSEGV: break;
+ case SIGTERM: break;
+ default:
+ PyErr_SetString(PyExc_ValueError, "invalid signal value");
+ return NULL;
}
#endif
#ifdef WITH_THREAD