{
    "mode": "pydoc",
    "parameter": "signal",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/signal/json",
    "generated": "2026-06-02T15:05:16Z",
    "sections": {
        "NAME": {
            "content": "signal\n",
            "subsections": []
        },
        "MODULE REFERENCE": {
            "content": "https://docs.python.org/3.10/library/signal.html\n\nThe following documentation is automatically generated from the Python\nsource files.  It may be incomplete, incorrect or include features that\nare considered implementation detail and may vary between Python\nimplementations.  When in doubt, consult the module reference at the\nlocation listed above.\n",
            "subsections": []
        },
        "CLASSES": {
            "content": "builtins.OSError(builtins.Exception)\nitimererror\nbuiltins.tuple(builtins.object)\nstructsiginfo\nenum.IntEnum(builtins.int, enum.Enum)\nHandlers\nSigmasks\nSignals\n",
            "subsections": [
                {
                    "name": "class Handlers",
                    "content": "|  Handlers(value, names=None, *, module=None, qualname=None, type=None, start=1)\n|\n|  An enumeration.\n|\n|  Method resolution order:\n|      Handlers\n|      enum.IntEnum\n|      builtins.int\n|      enum.Enum\n|      builtins.object\n|\n|  Data and other attributes defined here:\n|\n|  SIGDFL = <Handlers.SIGDFL: 0>\n|\n|  SIGIGN = <Handlers.SIGIGN: 1>\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from enum.Enum:\n|\n|  name\n|      The name of the Enum member.\n|\n|  value\n|      The value of the Enum member.\n|\n|  ----------------------------------------------------------------------\n|  Readonly properties inherited from enum.EnumMeta:\n|\n|  members\n|      Returns a mapping of member name->value.\n|\n|      This mapping lists all enum members, including aliases. Note that this\n|      is a read-only view of the internal mapping.\n\nItimerError = class itimererror(builtins.OSError)\n|  Method resolution order:\n|      itimererror\n|      builtins.OSError\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Data descriptors defined here:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.OSError:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.OSError:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.OSError:\n|\n|  characterswritten\n|\n|  errno\n|      POSIX exception code\n|\n|  filename\n|      exception filename\n|\n|  filename2\n|      second exception filename\n|\n|  strerror\n|      exception strerror\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class Sigmasks",
                    "content": "|  Sigmasks(value, names=None, *, module=None, qualname=None, type=None, start=1)\n|\n|  An enumeration.\n|\n|  Method resolution order:\n|      Sigmasks\n|      enum.IntEnum\n|      builtins.int\n|      enum.Enum\n|      builtins.object\n|\n|  Data and other attributes defined here:\n|\n|  SIGBLOCK = <Sigmasks.SIGBLOCK: 0>\n|\n|  SIGSETMASK = <Sigmasks.SIGSETMASK: 2>\n|\n|  SIGUNBLOCK = <Sigmasks.SIGUNBLOCK: 1>\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from enum.Enum:\n|\n|  name\n|      The name of the Enum member.\n|\n|  value\n|      The value of the Enum member.\n|\n|  ----------------------------------------------------------------------\n|  Readonly properties inherited from enum.EnumMeta:\n|\n|  members\n|      Returns a mapping of member name->value.\n|\n|      This mapping lists all enum members, including aliases. Note that this\n|      is a read-only view of the internal mapping.\n"
                },
                {
                    "name": "class Signals",
                    "content": "|  Signals(value, names=None, *, module=None, qualname=None, type=None, start=1)\n|\n|  An enumeration.\n|\n|  Method resolution order:\n|      Signals\n|      enum.IntEnum\n|      builtins.int\n|      enum.Enum\n|      builtins.object\n|\n|  Data and other attributes defined here:\n|\n|  SIGABRT = <Signals.SIGABRT: 6>\n|\n|  SIGALRM = <Signals.SIGALRM: 14>\n|\n|  SIGBUS = <Signals.SIGBUS: 7>\n|\n|  SIGCHLD = <Signals.SIGCHLD: 17>\n|\n|  SIGCONT = <Signals.SIGCONT: 18>\n|\n|  SIGFPE = <Signals.SIGFPE: 8>\n|\n|  SIGHUP = <Signals.SIGHUP: 1>\n|\n|  SIGILL = <Signals.SIGILL: 4>\n|\n|  SIGINT = <Signals.SIGINT: 2>\n|\n|  SIGIO = <Signals.SIGIO: 29>\n|\n|  SIGKILL = <Signals.SIGKILL: 9>\n|\n|  SIGPIPE = <Signals.SIGPIPE: 13>\n|\n|  SIGPROF = <Signals.SIGPROF: 27>\n|\n|  SIGPWR = <Signals.SIGPWR: 30>\n|\n|  SIGQUIT = <Signals.SIGQUIT: 3>\n|\n|  SIGRTMAX = <Signals.SIGRTMAX: 64>\n|\n|  SIGRTMIN = <Signals.SIGRTMIN: 34>\n|\n|  SIGSEGV = <Signals.SIGSEGV: 11>\n|\n|  SIGSTOP = <Signals.SIGSTOP: 19>\n|\n|  SIGSYS = <Signals.SIGSYS: 31>\n|\n|  SIGTERM = <Signals.SIGTERM: 15>\n|\n|  SIGTRAP = <Signals.SIGTRAP: 5>\n|\n|  SIGTSTP = <Signals.SIGTSTP: 20>\n|\n|  SIGTTIN = <Signals.SIGTTIN: 21>\n|\n|  SIGTTOU = <Signals.SIGTTOU: 22>\n|\n|  SIGURG = <Signals.SIGURG: 23>\n|\n|  SIGUSR1 = <Signals.SIGUSR1: 10>\n|\n|  SIGUSR2 = <Signals.SIGUSR2: 12>\n|\n|  SIGVTALRM = <Signals.SIGVTALRM: 26>\n|\n|  SIGWINCH = <Signals.SIGWINCH: 28>\n|\n|  SIGXCPU = <Signals.SIGXCPU: 24>\n|\n|  SIGXFSZ = <Signals.SIGXFSZ: 25>\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from enum.Enum:\n|\n|  name\n|      The name of the Enum member.\n|\n|  value\n|      The value of the Enum member.\n|\n|  ----------------------------------------------------------------------\n|  Readonly properties inherited from enum.EnumMeta:\n|\n|  members\n|      Returns a mapping of member name->value.\n|\n|      This mapping lists all enum members, including aliases. Note that this\n|      is a read-only view of the internal mapping.\n"
                },
                {
                    "name": "class struct_siginfo",
                    "content": "|  structsiginfo(iterable=(), /)\n|\n|  structsiginfo: Result from sigwaitinfo or sigtimedwait.\n|\n|  This object may be accessed either as a tuple of\n|  (sisigno, sicode, sierrno, sipid, siuid, sistatus, siband),\n|  or via the attributes sisigno, sicode, and so on.\n|\n|  Method resolution order:\n|      structsiginfo\n|      builtins.tuple\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  siband\n|      band event for SIGPOLL\n|\n|  sicode\n|      signal code\n|\n|  sierrno\n|      errno associated with this signal\n|\n|  sipid\n|      sending process ID\n|\n|  sisigno\n|      signal number\n|\n|  sistatus\n|      exit value or signal\n|\n|  siuid\n|      real user ID of sending process\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  matchargs = ('sisigno', 'sicode', 'sierrno', 'sipid', 'siuid...\n|\n|  nfields = 7\n|\n|  nsequencefields = 7\n|\n|  nunnamedfields = 0\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.tuple:\n|\n|  add(self, value, /)\n|      Return self+value.\n|\n|  contains(self, key, /)\n|      Return key in self.\n|\n|  eq(self, value, /)\n|      Return self==value.\n|\n|  ge(self, value, /)\n|      Return self>=value.\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  getitem(self, key, /)\n|      Return self[key].\n|\n|  getnewargs(self, /)\n|\n|  gt(self, value, /)\n|      Return self>value.\n|\n|  hash(self, /)\n|      Return hash(self).\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  le(self, value, /)\n|      Return self<=value.\n|\n|  len(self, /)\n|      Return len(self).\n|\n|  lt(self, value, /)\n|      Return self<value.\n|\n|  mul(self, value, /)\n|      Return self*value.\n|\n|  ne(self, value, /)\n|      Return self!=value.\n|\n|  rmul(self, value, /)\n|      Return value*self.\n|\n|  count(self, value, /)\n|      Return number of occurrences of value.\n|\n|  index(self, value, start=0, stop=9223372036854775807, /)\n|      Return first index of value.\n|\n|      Raises ValueError if the value is not present.\n|\n|  ----------------------------------------------------------------------\n|  Class methods inherited from builtins.tuple:\n|\n|  classgetitem(...) from builtins.type\n|      See PEP 585\n"
                }
            ]
        },
        "FUNCTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "alarm",
                    "content": "Arrange for SIGALRM to arrive after the given number of seconds.\n"
                },
                {
                    "name": "default_int_handler",
                    "content": "The default handler for SIGINT installed by Python.\n\nIt raises KeyboardInterrupt.\n"
                },
                {
                    "name": "getitimer",
                    "content": "Returns current value of given itimer.\n"
                },
                {
                    "name": "getsignal",
                    "content": "Return the current action for the given signal.\n\nThe return value can be:\nSIGIGN -- if the signal is being ignored\nSIGDFL -- if the default action for the signal is in effect\nNone    -- if an unknown handler is in effect\nanything else -- the callable Python object used as a handler\n"
                },
                {
                    "name": "pause",
                    "content": "Wait until a signal arrives.\n"
                },
                {
                    "name": "pidfd_send_signal",
                    "content": "Send a signal to a process referred to by a pid file descriptor.\n"
                },
                {
                    "name": "pthread_kill",
                    "content": "Send a signal to a thread.\n"
                },
                {
                    "name": "pthread_sigmask",
                    "content": "Fetch and/or change the signal mask of the calling thread.\n"
                },
                {
                    "name": "raise_signal",
                    "content": "Send a signal to the executing process.\n"
                },
                {
                    "name": "set_wakeup_fd",
                    "content": "setwakeupfd(fd, *, warnonfullbuffer=True) -> fd\n\nSets the fd to be written to (with the signal number) when a signal\ncomes in.  A library can use this to wakeup select or poll.\nThe previous fd or -1 is returned.\n\nThe fd must be non-blocking.\n"
                },
                {
                    "name": "setitimer",
                    "content": "Sets given itimer (one of ITIMERREAL, ITIMERVIRTUAL or ITIMERPROF).\n\nThe timer will fire after value seconds and after that every interval seconds.\nThe itimer can be cleared by setting seconds to zero.\n\nReturns old values as a tuple: (delay, interval).\n"
                },
                {
                    "name": "siginterrupt",
                    "content": "Change system call restart behaviour.\n\nIf flag is False, system calls will be restarted when interrupted by\nsignal sig, else system calls will be interrupted.\n"
                },
                {
                    "name": "signal",
                    "content": "Set the action for the given signal.\n\nThe action can be SIGDFL, SIGIGN, or a callable Python object.\nThe previous action is returned.  See getsignal() for possible return values.\n\n* IMPORTANT NOTICE *\nA signal handler function is called with two arguments:\nthe first is the signal number, the second is the interrupted stack frame.\n"
                },
                {
                    "name": "sigpending",
                    "content": "Examine pending signals.\n\nReturns a set of signal numbers that are pending for delivery to\nthe calling thread.\n"
                },
                {
                    "name": "sigtimedwait",
                    "content": "Like sigwaitinfo(), but with a timeout.\n\nThe timeout is specified in seconds, with floating point numbers allowed.\n"
                },
                {
                    "name": "sigwait",
                    "content": "Wait for a signal.\n\nSuspend execution of the calling thread until the delivery of one of the\nsignals specified in the signal set sigset.  The function accepts the signal\nand returns the signal number.\n"
                },
                {
                    "name": "sigwaitinfo",
                    "content": "Wait synchronously until one of the signals in *sigset* is delivered.\n\nReturns a structsiginfo containing information about the signal.\n"
                },
                {
                    "name": "strsignal",
                    "content": "Return the system description of the given signal.\n\nThe return values can be such as \"Interrupt\", \"Segmentation fault\", etc.\nReturns None if the signal is not recognized.\n"
                },
                {
                    "name": "valid_signals",
                    "content": "Return a set of valid signal numbers on this platform.\n\nThe signal numbers returned by this function can be safely passed to\nfunctions like `pthreadsigmask`.\n"
                }
            ]
        },
        "DATA": {
            "content": "ITIMERPROF = 2\nITIMERREAL = 0\nITIMERVIRTUAL = 1\nNSIG = 65\nSIGABRT = <Signals.SIGABRT: 6>\nSIGALRM = <Signals.SIGALRM: 14>\nSIGBUS = <Signals.SIGBUS: 7>\nSIGCHLD = <Signals.SIGCHLD: 17>\nSIGCLD = <Signals.SIGCHLD: 17>\nSIGCONT = <Signals.SIGCONT: 18>\nSIGFPE = <Signals.SIGFPE: 8>\nSIGHUP = <Signals.SIGHUP: 1>\nSIGILL = <Signals.SIGILL: 4>\nSIGINT = <Signals.SIGINT: 2>\nSIGIO = <Signals.SIGIO: 29>\nSIGIOT = <Signals.SIGABRT: 6>\nSIGKILL = <Signals.SIGKILL: 9>\nSIGPIPE = <Signals.SIGPIPE: 13>\nSIGPOLL = <Signals.SIGIO: 29>\nSIGPROF = <Signals.SIGPROF: 27>\nSIGPWR = <Signals.SIGPWR: 30>\nSIGQUIT = <Signals.SIGQUIT: 3>\nSIGRTMAX = <Signals.SIGRTMAX: 64>\nSIGRTMIN = <Signals.SIGRTMIN: 34>\nSIGSEGV = <Signals.SIGSEGV: 11>\nSIGSTOP = <Signals.SIGSTOP: 19>\nSIGSYS = <Signals.SIGSYS: 31>\nSIGTERM = <Signals.SIGTERM: 15>\nSIGTRAP = <Signals.SIGTRAP: 5>\nSIGTSTP = <Signals.SIGTSTP: 20>\nSIGTTIN = <Signals.SIGTTIN: 21>\nSIGTTOU = <Signals.SIGTTOU: 22>\nSIGURG = <Signals.SIGURG: 23>\nSIGUSR1 = <Signals.SIGUSR1: 10>\nSIGUSR2 = <Signals.SIGUSR2: 12>\nSIGVTALRM = <Signals.SIGVTALRM: 26>\nSIGWINCH = <Signals.SIGWINCH: 28>\nSIGXCPU = <Signals.SIGXCPU: 24>\nSIGXFSZ = <Signals.SIGXFSZ: 25>\nSIGBLOCK = <Sigmasks.SIGBLOCK: 0>\nSIGDFL = <Handlers.SIGDFL: 0>\nSIGIGN = <Handlers.SIGIGN: 1>\nSIGSETMASK = <Sigmasks.SIGSETMASK: 2>\nSIGUNBLOCK = <Sigmasks.SIGUNBLOCK: 1>\n",
            "subsections": []
        },
        "FILE": {
            "content": "/usr/lib/python3.10/signal.py\n\n",
            "subsections": []
        }
    },
    "summary": "signal",
    "flags": [],
    "examples": [],
    "see_also": [],
    "tldr": {
        "source": "official",
        "description": "Simplified software signal facilities.",
        "examples": [
            {
                "description": "View documentation for signals in macOS",
                "command": "man signal"
            }
        ]
    }
}