@@ -269,153 +269,6 @@ SIG_DFL -- if the default action for the signal is in effect\n\
269269None -- if an unknown handler is in effect\n\
270270anything else -- the callable Python object used as a handler" );
271271
272- #ifdef HAVE_SIGPROCMASK /* we assume that having SIGPROCMASK is enough
273- to guarantee full POSIX signal handling */
274- /* returns 0 for success, <0 for failure (with exception set) */
275- static int
276- _signal_list_to_sigset (PyObject * seq , sigset_t * set , char * mesg )
277- {
278- int i , len , val ;
279-
280- seq = PySequence_Fast (seq , mesg );
281- if (!seq )
282- return -1 ;
283-
284- len = PySequence_Fast_GET_SIZE (seq );
285-
286- sigemptyset (set );
287-
288- for (i = 0 ; i < len ; i ++ ) {
289- val = PyInt_AsLong (PySequence_Fast_GET_ITEM (seq , i ));
290- if (val == -1 && PyErr_Occurred ()) {
291- Py_DECREF (seq );
292- return -1 ;
293- }
294- if (sigaddset (set , val ) < 0 ) {
295- Py_DECREF (seq );
296- PyErr_SetFromErrno (PyExc_ValueError );
297- return -1 ;
298- }
299- }
300-
301- Py_DECREF (seq );
302- return 0 ;
303- }
304-
305- static PyObject *
306- _signal_sigset_to_list (sigset_t * set )
307- {
308- PyObject * ret ;
309- PyObject * ob ;
310- int i ;
311-
312- ret = PyList_New (0 );
313- if (!ret )
314- return NULL ;
315-
316- for (i = 1 ; i < NSIG ; i ++ ) {
317- if (sigismember (set , i )) {
318- ob = PyInt_FromLong (i );
319- if (!ob ) {
320- Py_DECREF (ret );
321- return NULL ;
322- }
323- PyList_Append (ret , ob );
324- Py_DECREF (ob );
325- }
326- }
327-
328- return ret ;
329- }
330-
331- static PyObject *
332- signal_sigprocmask (PyObject * self , PyObject * args )
333- {
334- int how ;
335- sigset_t newset , oldset ;
336- PyObject * seq ;
337-
338- if (!PyArg_ParseTuple (args , "iO" , & how , & seq ))
339- return NULL ;
340-
341- if (_signal_list_to_sigset (seq , & newset ,
342- "sigprocmask requires a sequence" ) < 0 )
343- return NULL ;
344-
345- if (sigprocmask (how , & newset , & oldset ) < 0 ) {
346- return PyErr_SetFromErrno (PyExc_ValueError );
347- }
348-
349- if (PyErr_CheckSignals ())
350- return NULL ;
351-
352- return _signal_sigset_to_list (& oldset );
353- }
354-
355- PyDoc_STRVAR (sigprocmask_doc ,
356- "sigprocmask(how, sigset) -> sigset\n\
357- \n\
358- Change the list of currently blocked signals. The parameter how should be\n\
359- one of SIG_BLOCK, SIG_UNBLOCK or SIG_SETMASK and sigset should be a\n\
360- sequence of signal numbers. The behaviour of the call depends on the value\n\
361- of how:\n\
362- \n\
363- SIG_BLOCK\n\
364- The set of blocked signals is the union of the current set and the\n\
365- sigset argument.\n\
366- SIG_UNBLOCK\n\
367- The signals in sigset are removed from the current set of blocked\n\
368- signals. It is legal to attempt to unblock a signal which is not\n\
369- blocked.\n\
370- SIG_SETMASK\n\
371- The set of blocked signals is set to the argument set.\n\
372- \n\
373- A list contating the numbers of the previously blocked signals is returned." );
374-
375- static PyObject *
376- signal_sigpending (PyObject * self )
377- {
378- sigset_t set ;
379-
380- if (sigpending (& set ) < 0 ) {
381- return PyErr_SetFromErrno (PyExc_ValueError );
382- }
383-
384- return _signal_sigset_to_list (& set );
385- }
386-
387- PyDoc_STRVAR (sigpending_doc ,
388- "sigpending() -> sigset\n\
389- \n\
390- Return the set of pending signals, i.e. a list containing the numbers of\n\
391- those signals that have been raised while blocked." );
392-
393- static PyObject *
394- signal_sigsuspend (PyObject * self , PyObject * arg )
395- {
396- sigset_t set ;
397-
398- if (_signal_list_to_sigset (arg , & set ,
399- "sigsuspend requires a sequence" ) < 0 )
400- return NULL ;
401-
402- Py_BEGIN_ALLOW_THREADS
403- sigsuspend (& set );
404- Py_END_ALLOW_THREADS
405-
406- if (PyErr_CheckSignals ())
407- return NULL ;
408-
409- Py_INCREF (Py_None );
410- return Py_None ;
411- }
412-
413- PyDoc_STRVAR (sigsuspend_doc ,
414- "sigsuspend(sigset) -> None\n\
415- \n\
416- Temporarily replace the signal mask with sigset (which should be a sequence\n\
417- of signal numbers) and suspend the process until a signal is received." );
418- #endif
419272
420273/* List of functions defined in the module */
421274static PyMethodDef signal_methods [] = {
@@ -430,14 +283,6 @@ static PyMethodDef signal_methods[] = {
430283#endif
431284 {"default_int_handler" , signal_default_int_handler ,
432285 METH_VARARGS , default_int_handler_doc },
433- #ifdef HAVE_SIGPROCMASK
434- {"sigprocmask" , (PyCFunction )signal_sigprocmask ,
435- METH_VARARGS , sigprocmask_doc },
436- {"sigpending" , (PyCFunction )signal_sigpending ,
437- METH_NOARGS , sigpending_doc },
438- {"sigsuspend" , (PyCFunction )signal_sigsuspend ,
439- METH_O , sigsuspend_doc },
440- #endif
441286 {NULL , NULL } /* sentinel */
442287};
443288
@@ -453,10 +298,6 @@ getsignal() -- get the signal action for a given signal\n\
453298pause() -- wait until a signal arrives [Unix only]\n\
454299default_int_handler() -- default SIGINT handler\n\
455300\n\
456- sigpending() |\n\
457- sigprocmask() |-- posix signal mask handling [Unix only]\n\
458- sigsuspend() |\n\
459- \n\
460301Constants:\n\
461302\n\
462303SIG_DFL -- used to refer to the system default handler\n\
@@ -705,18 +546,6 @@ initsignal(void)
705546 PyDict_SetItemString (d , "SIGINFO" , x );
706547 Py_XDECREF (x );
707548#endif
708- #ifdef HAVE_SIGPROCMASK
709- x = PyInt_FromLong (SIG_BLOCK );
710- PyDict_SetItemString (d , "SIG_BLOCK" , x );
711- Py_XDECREF (x );
712- x = PyInt_FromLong (SIG_UNBLOCK );
713- PyDict_SetItemString (d , "SIG_UNBLOCK" , x );
714- Py_XDECREF (x );
715- x = PyInt_FromLong (SIG_SETMASK );
716- PyDict_SetItemString (d , "SIG_SETMASK" , x );
717- Py_XDECREF (x );
718- #endif
719-
720549 if (!PyErr_Occurred ())
721550 return ;
722551
0 commit comments