]> granicus.if.org Git - python/commitdiff
Issue #21382: Clarify signal.signal() documentation on Windows
authorBerker Peksag <berker.peksag@gmail.com>
Sat, 23 Apr 2016 23:59:16 +0000 (02:59 +0300)
committerBerker Peksag <berker.peksag@gmail.com>
Sat, 23 Apr 2016 23:59:16 +0000 (02:59 +0300)
All signal.SIG* constants may not be defined on Windows so a call like

    signal.signal(signal.SIGPIPE, lambda signum, frame: sys.exit(1))

will raise an AttributeError.

Doc/library/signal.rst

index 98eb7fdf209f7a82371c6154caf517a20d184229..d02a0a8e3c8cb464b302a467db1a18d6c6917a87 100644 (file)
@@ -351,6 +351,9 @@ The :mod:`signal` module defines the following functions:
    On Windows, :func:`signal` can only be called with :const:`SIGABRT`,
    :const:`SIGFPE`, :const:`SIGILL`, :const:`SIGINT`, :const:`SIGSEGV`, or
    :const:`SIGTERM`. A :exc:`ValueError` will be raised in any other case.
+   Note that not all systems define the same set of signal names; an
+   :exc:`AttributeError` will be raised if a signal name is not defined as
+   ``SIG*`` module level constant.
 
 
 .. function:: sigpending()