summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-03-16 15:43:29 (GMT)
committerGuido van Rossum <guido@python.org>1995-03-16 15:43:29 (GMT)
commitf4b012a9e0b179b03d5a7049651d8e5b19e41d52 (patch)
tree407c08036b1cc434fc93f89ecca6c610bf47e268 /Modules
parent4f17e3e2f94f334965f304aa65056af3fcdbbca3 (diff)
downloadcpython-f4b012a9e0b179b03d5a7049651d8e5b19e41d52.zip
cpython-f4b012a9e0b179b03d5a7049651d8e5b19e41d52.tar.gz
cpython-f4b012a9e0b179b03d5a7049651d8e5b19e41d52.tar.bz2
use PyCallable_Check; split some lines
Diffstat (limited to 'Modules')
-rw-r--r--Modules/signalmodule.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 9831f75..fe79447 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -167,21 +167,21 @@ PySignal_Signal(self, args)
return (PyObject *)NULL;
#ifdef WITH_THREAD
if (get_thread_ident() != main_thread) {
- PyErr_SetString(PyExc_ValueError, "signal only works in main thread");
+ PyErr_SetString(PyExc_ValueError,
+ "signal only works in main thread");
return (PyObject *)NULL;
}
#endif
if (sig_num < 1 || sig_num >= NSIG) {
- PyErr_SetString(PyExc_ValueError, "signal number out of range");
+ PyErr_SetString(PyExc_ValueError,
+ "signal number out of range");
return (PyObject *)NULL;
}
if (obj == PySignal_SignalIgnoreHandler)
func = SIG_IGN;
else if (obj == PySignal_SignalDefaultHandler)
func = SIG_DFL;
- else if (!PyCFunction_Check(obj) &&
- !PyFunction_Check(obj) &&
- !PyMethod_Check(obj)) {
+ else if (!PyCallable_Check(obj)) {
PyErr_SetString(PyExc_TypeError,
"signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object");
return (PyObject *)NULL;
@@ -209,7 +209,8 @@ PySignal_GetSignal(self, args)
if (!PyArg_Parse(args, "i", &sig_num))
return (PyObject *)NULL;
if (sig_num < 1 || sig_num >= NSIG) {
- PyErr_SetString(PyExc_ValueError, "signal number out of range");
+ PyErr_SetString(PyExc_ValueError,
+ "signal number out of range");
return (PyObject *)NULL;
}
old_handler = PySignal_SignalHandlerArray[sig_num].func;
@@ -265,17 +266,22 @@ initsignal()
signal(i, t);
PySignal_SignalHandlerArray[i].tripped = 0;
if (t == SIG_DFL)
- PySignal_SignalHandlerArray[i].func = PySignal_SignalDefaultHandler;
+ PySignal_SignalHandlerArray[i].func =
+ PySignal_SignalDefaultHandler;
else if (t == SIG_IGN)
- PySignal_SignalHandlerArray[i].func = PySignal_SignalIgnoreHandler;
+ PySignal_SignalHandlerArray[i].func =
+ PySignal_SignalIgnoreHandler;
else
- PySignal_SignalHandlerArray[i].func = Py_None; /* None of our business */
+ PySignal_SignalHandlerArray[i].func =
+ Py_None; /* None of our business */
Py_INCREF(PySignal_SignalHandlerArray[i].func);
}
- if (PySignal_SignalHandlerArray[SIGINT].func == PySignal_SignalDefaultHandler) {
+ if (PySignal_SignalHandlerArray[SIGINT].func ==
+ PySignal_SignalDefaultHandler) {
/* Install default int handler */
Py_DECREF(PySignal_SignalHandlerArray[SIGINT].func);
- PySignal_SignalHandlerArray[SIGINT].func = PySignal_DefaultIntHandler;
+ PySignal_SignalHandlerArray[SIGINT].func =
+ PySignal_DefaultIntHandler;
Py_INCREF(PySignal_DefaultIntHandler);
signal(SIGINT, &PySignal_Handler);
}
@@ -443,7 +449,8 @@ PyErr_CheckSignals()
if (arglist == (PyObject *)NULL)
result = (PyObject *)NULL;
else {
- result = PyEval_CallObject(PySignal_SignalHandlerArray[i].func,arglist);
+ result = PyEval_CallObject(
+ PySignal_SignalHandlerArray[i].func, arglist);
Py_DECREF(arglist);
}
if (result == (PyObject *)NULL) {