<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import <EOL> from gevent . _util import _NONE as _INITIAL <EOL> from gevent . _util import copy_globals <EOL> import signal as _signal <EOL> __implements__ = [ ] <EOL> __extensions__ = [ ] <EOL> _child_handler = _INITIAL <EOL> _signal_signal = _signal . signal <EOL> _signal_getsignal = _signal . getsignal <EOL> def getsignal ( signalnum ) : <EOL> """<STR_LIT>""" <EOL> if signalnum != _signal . SIGCHLD : <EOL> return _signal_getsignal ( signalnum ) <EOL> global _child_handler <EOL> if _child_handler is _INITIAL : <EOL> _child_handler = _signal_getsignal ( _signal . SIGCHLD ) <EOL> return _child_handler <EOL> def signal ( signalnum , handler ) : <EOL> """<STR_LIT>""" <EOL> if signalnum != _signal . SIGCHLD : <EOL> return _signal_signal ( signalnum , handler ) <EOL> if handler != _signal . SIG_IGN and handler != _signal . SIG_DFL and not callable ( handler ) : <EOL> raise TypeError ( "<STR_LIT>" ) <EOL> old_handler = getsignal ( signalnum ) <EOL> global _child_handler <EOL> _child_handler = handler <EOL> if handler == _signal . SIG_IGN or handler == _signal . SIG_DFL : <EOL> _signal_signal ( signalnum , handler ) <EOL> return old_handler <EOL> def _on_child_hook ( ) : <EOL> if callable ( _child_handler ) : <EOL> from gevent import Greenlet <EOL> greenlet = Greenlet ( _child_handler , _signal . SIGCHLD , None ) <EOL> greenlet . switch ( ) <EOL> import gevent . os <EOL> if '<STR_LIT>' in gevent . os . __implements__ and hasattr ( _signal , '<STR_LIT>' ) : <EOL> gevent . os . _on_child_hook = _on_child_hook <EOL> __implements__ . append ( "<STR_LIT>" ) <EOL> __implements__ . append ( "<STR_LIT>" ) <EOL> else : <EOL> __extensions__ . append ( "<STR_LIT>" ) <EOL> __extensions__ . append ( "<STR_LIT>" ) <EOL> __imports__ = copy_globals ( _signal , globals ( ) , <EOL> names_to_ignore = __implements__ + __extensions__ , <EOL> dunder_names_to_keep = ( ) ) <EOL> __all__ = __implements__ + __extensions__ </s>
